1##########################
2# Included files
3##########################
4!addincludedir ${NSIDIR}
5!addplugindir ${NSIDIR}/plugin
6
7!include Sections.nsh
8!include MUI2.nsh
9!include nsDialogs.nsh
10!include Memento.nsh
11!include FileFunc.nsh
12!include UAC.nsh
13!include WinVer.nsh
14!include WordFunc.nsh
15#!include revision.nsh
16
17SetCompressor /SOLID lzma
18SetCompressorDictSize 96
19RequestExecutionLevel user
20
21##########################
22# Defines
23##########################
24!define BUILD_BITS 32
25!define QT_DIR /mingw/Qt/current/bin/
26!define ADM_SYSDIR /mingw/bin
27!define ADM_DIR /mingw/Release
28!define TOOLCHAIN_DIR /home/fx/mxe-octave/usr/lib/gcc/i686-pc-mingw32/4.7.2/
29#/home/fx/rub/mingw32/
30#!define NSIDIR "/home/fx/hudson/workspace/mingw_2.6.2_nsis/avidemux/winInstaller"
31#!define SVN_VERSION 6
32!define REVISION ${SVN_VERSION}
33!define EXEDIR "${NSIDIR}/install"
34
35!define CORE_VERSION "2.6"
36!define POINT_RELEASE "8"
37!define PRODUCT_VERSION "${CORE_VERSION}.${POINT_RELEASE}.${SVN_VERSION}"
38!define PRODUCT_NAME "Avidemux ${CORE_VERSION}"
39!define PRODUCT_FULLNAME "Avidemux ${PRODUCT_VERSION} (${BUILD_BITS}-bit Release)"
40
41!if ${BUILD_BITS} == 64
42	!define SHORTCUT_NAME "${PRODUCT_NAME}"
43	!define REG_GROUPNAME "${PRODUCT_NAME} (${BUILD_BITS}-bit)"
44!else
45	!define SHORTCUT_NAME "${PRODUCT_NAME} (${BUILD_BITS}-bit)"
46	!define REG_GROUPNAME "${PRODUCT_NAME}"
47!endif
48
49!define REGKEY "SOFTWARE\${REG_GROUPNAME}"
50!define UNINST_REGKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_GROUPNAME}"
51!define COMPANY "Free Software Foundation"
52!define URL "http://www.avidemux.org"
53
54OutFile "${EXEDIR}/avidemux_${CORE_VERSION}.${POINT_RELEASE}_r${REVISION}_win${BUILD_BITS}.exe"
55Name "${PRODUCT_FULLNAME}"
56
57##########################
58# Memento defines
59##########################
60!define MEMENTO_REGISTRY_ROOT HKLM
61!define MEMENTO_REGISTRY_KEY "${REGKEY}"
62
63##########################
64# MUI defines
65##########################
66!define MUI_ICON "${NSIDIR}/../common/xpm/adm.ico"
67!define MUI_HEADERIMAGE
68!define MUI_HEADERIMAGE_RIGHT
69!define MUI_HEADERIMAGE_BITMAP "${NSIDIR}/PageHeader.bmp"
70!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
71!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGKEY}"
72!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
73!define MUI_STARTMENUPAGE_DEFAULTFOLDER Avidemux
74!define MUI_STARTMENUPAGE_NODISABLE
75!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
76!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
77!define MUI_UNICON "${NSIDIR}/../common/xpm/adm.ico"
78!define MUI_COMPONENTSPAGE_NODESC
79
80##########################
81# Variables
82##########################
83Var CreateDesktopIcon
84Var CreateStartMenuGroup
85Var CreateQuickLaunchIcon
86Var StartMenuGroup
87Var PreviousVersion
88Var PreviousVersionState
89Var ReinstallUninstall
90
91##########################
92# Installer pages
93##########################
94!define MUI_WELCOMEPAGE_TITLE "${PRODUCT_FULLNAME} Setup Wizard"
95!insertmacro MUI_PAGE_WELCOME
96!insertmacro MUI_PAGE_LICENSE "${NSIDIR}/License.rtf"
97 Page custom ReinstallPage ReinstallPageLeave
98!insertmacro MUI_PAGE_COMPONENTS
99Page custom InstallOptionsPage
100!define MUI_PAGE_CUSTOMFUNCTION_PRE IsStartMenuRequired
101!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
102!insertmacro MUI_PAGE_DIRECTORY
103!define MUI_PAGE_CUSTOMFUNCTION_PRE ActivateInternalSections
104!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesPageShow
105!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstFilesPageLeave
106!insertmacro MUI_PAGE_INSTFILES
107!define MUI_FINISHPAGE_RUN
108!define MUI_FINISHPAGE_RUN_FUNCTION RunAvidemux
109!define MUI_FINISHPAGE_RUN_TEXT "Run ${PRODUCT_NAME} now"
110!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR/Change Log.html"
111!define MUI_FINISHPAGE_SHOWREADME_TEXT "View Change Log now"
112!define MUI_FINISHPAGE_LINK "Visit the Avidemux website"
113!define MUI_FINISHPAGE_LINK_LOCATION "http://avidemux.org/"
114!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfigureFinishPage
115!insertmacro MUI_PAGE_FINISH
116
117!define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
118!insertmacro MUI_UNPAGE_CONFIRM
119!insertmacro MUI_UNPAGE_INSTFILES
120!define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
121!insertmacro MUI_UNPAGE_FINISH
122
123##########################
124# Installer languages
125##########################
126!insertmacro MUI_LANGUAGE English
127
128##########################
129# Installer attributes
130##########################
131!if ${BUILD_BITS} == 64
132	InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
133!else
134	InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
135!endif
136
137CRCCheck on
138XPStyle on
139ShowInstDetails nevershow
140ShowUninstDetails nevershow
141VIProductVersion ${PRODUCT_VERSION}
142VIAddVersionKey ProductName Avidemux
143VIAddVersionKey ProductVersion "${PRODUCT_VERSION}"
144VIAddVersionKey FileVersion ""
145VIAddVersionKey FileDescription ""
146VIAddVersionKey LegalCopyright ""
147InstallDirRegKey HKLM "${REGKEY}" Path
148BrandingText "Packaged by Gruntster"
149InstType Standard
150InstType Full
151#########################################
152#
153#########################################
154Function GetAfterChar
155  Exch $0 ; chop char
156  Exch
157  Exch $1 ; input string
158  Push $2
159  Push $3
160  StrCpy $2 0
161  loop:
162    IntOp $2 $2 - 1
163    StrCpy $3 $1 1 $2
164    StrCmp $3 "" 0 +3
165      StrCpy $0 ""
166      Goto exit2
167    StrCmp $3 $0 exit1
168    Goto loop
169  exit1:
170    IntOp $2 $2 + 1
171    StrCpy $0 $1 "" $2
172  exit2:
173    Pop $3
174    Pop $2
175    Pop $1
176    Exch $0 ; output
177FunctionEnd
178#####################################################################�
179!define StrReplace '!insertmacro "_Name"'
180
181##########################
182# Uninstaller macros
183##########################
184!insertmacro un.GetOptions
185!insertmacro un.GetParameters
186
187!define UninstallLogPath "$INSTDIR\uninstall.log"
188Var UninstallLogHandle
189
190; Uninstall log file missing.
191LangString UninstallLogMissing ${LANG_ENGLISH} "uninstall.log not found!$\r$\nUninstallation cannot proceed!"
192# Regexep Does not work with cross
193# Use only one file at a time
194!macro InstallFile FILEZ
195	File "${FILEZ}"
196	Push "${FILEZ}"
197	Push "/"
198	Call GetAfterChar
199	Pop $R0
200	FileWrite $UninstallLogHandle "$OUTDIR\$R0$\r$\n"
201!macroend
202!define File "!insertmacro InstallFile"
203
204!macro InstallFolder FILEREGEX
205	File /r "${FILEREGEX}/*"
206	Push "$OUTDIR"
207	Call InstallFolderInternal
208!macroend
209!define Folder "!insertmacro InstallFolder"
210
211Function InstallFolderInternal
212	Pop $9
213	!define Index 'Line${__LINE__}'
214	FindFirst $0 $1 "$9/*"
215	StrCmp $0 "" "${Index}-End"
216"${Index}-Loop:"
217	StrCmp $1 "" "${Index}-End"
218	StrCmp $1 "." "${Index}-Next"
219	StrCmp $1 ".." "${Index}-Next"
220	IfFileExists "$9\$1\*" 0 "${Index}-Write"
221		Push $0
222		Push $9
223		Push "$9\$1"
224		Call InstallFolderInternal
225		Pop $9
226		Pop $0
227		Goto "${Index}-Next"
228"${Index}-Write:"
229	FileWrite $UninstallLogHandle "$9\$1$\r$\n"
230"${Index}-Next:"
231	FindNext $0 $1
232	Goto "${Index}-Loop"
233"${Index}-End:"
234	!undef Index
235FunctionEnd
236
237; WriteUninstaller macro
238!macro WriteUninstaller Path
239	WriteUninstaller "${Path}"
240	FileWrite $UninstallLogHandle "${Path}$\r$\n"
241!macroend
242!define WriteUninstaller "!insertmacro WriteUninstaller"
243
244##########################
245# Macros
246##########################
247
248!macro InstallQtLanguage LANG_NAME LANG_CODE
249	SetOverwrite on
250
251	!insertmacro SectionFlagIsSet ${SecUiQt} ${SF_SELECTED} installQt${LANG_CODE} endQt${LANG_CODE}
252
253installQt${LANG_CODE}:
254	SetOutPath $INSTDIR\i18n
255    ${File} i18n/avidemux_${LANG_CODE}.qm
256    ${File} i18n/qt_${LANG_CODE}.qm
257
258endQt${LANG_CODE}:
259!macroend
260
261##########################
262# Installer sections
263##########################
264Section -OpenLogFile
265	CreateDirectory "$INSTDIR"
266	FileOpen $UninstallLogHandle ${UninstallLogPath} a
267	FileSeek $UninstallLogHandle 0 END
268SectionEnd
269
270Section "Avidemux Core" SecCore
271    SectionIn 1 2 RO
272    SetOutPath $INSTDIR
273    SetOverwrite on
274    ${File} "./Build Info.txt"
275    ${File} "./last_changes.txt"
276    ${File} "./Change Log.html"
277#
278#
279    ${File} ${TOOLCHAIN_DIR}/libstdc++-6.dll
280    ${File} ${TOOLCHAIN_DIR}/../libgcc_s_dw2-1.dll
281#
282#
283    ${File} ${ADM_SYSDIR}/libsqlite3-0.dll
284    ${File} ${ADM_SYSDIR}/libz.dll
285    ${File} ${ADM_SYSDIR}/libpng15-15.dll
286    ${File} ${ADM_SYSDIR}/libpthread.dll
287#
288#
289    ${File} ${ADM_DIR}/libADM_audioParser6.dll
290    ${File} ${ADM_DIR}/libADM_core6.dll
291    ${File} ${ADM_DIR}/libADM_coreAudio6.dll
292    ${File} ${ADM_DIR}/libADM_coreAudioDevice6.dll
293    ${File} ${ADM_DIR}/libADM_coreAudioEncoder6.dll
294    ${File} ${ADM_DIR}/libADM_coreAudioFilterAPI6.dll
295    ${File} ${ADM_DIR}/libADM_coreDemuxer6.dll
296    ${File} ${ADM_DIR}/libADM_coreDemuxerMpeg6.dll
297    ${File} ${ADM_DIR}/libADM_coreImage6.dll
298    ${File} ${ADM_DIR}/libADM_coreImageLoader6.dll
299    ${File} ${ADM_DIR}/libADM_coreJobs.dll
300    ${File} ${ADM_DIR}/libADM_coreMuxer6.dll
301    ${File} ${ADM_DIR}/libADM_coreScript.dll
302    ${File} ${ADM_DIR}/libADM_coreSocket6.dll
303    ${File} ${ADM_DIR}/libADM_coreSqlLight3.dll
304    ${File} ${ADM_DIR}/libADM_coreUI6.dll
305    ${File} ${ADM_DIR}/libADM_coreUtils6.dll
306    ${File} ${ADM_DIR}/libADM_coreVideoCodec6.dll
307    ${File} ${ADM_DIR}/libADM_coreVideoEncoder6.dll
308    ${File} ${ADM_DIR}/libADM_coreVideoFilter6.dll
309    ${File} ${ADM_DIR}/libADM_coreSubtitle.dll
310    ${File} ${QT_DIR}/QtCore4.dll
311    ${File} ${QT_DIR}/QtGui4.dll
312    ${File} ${NSIDIR}/../../AUTHORS.
313    ${File} ${NSIDIR}/../../COPYING.
314    ${File} ${NSIDIR}/../../README.
315    ${File} ${ADM_DIR}/avcodec-*.dll
316    ${File} ${ADM_DIR}/avformat-*.dll
317    ${File} ${ADM_DIR}/avutil-*.dll
318    ${File} ${ADM_DIR}/postproc-*.dll
319    ${File} ${ADM_DIR}/swscale-*.dll
320
321	WriteRegStr HKLM "${REGKEY}" CreateDesktopIcon $CreateDesktopIcon
322	WriteRegStr HKLM "${REGKEY}" CreateStartMenuGroup $CreateStartMenuGroup
323
324	${If} ${AtMostWinVista}
325		WriteRegStr HKLM "${REGKEY}" CreateQuickLaunchIcon $CreateQuickLaunchIcon
326	${EndIf}
327SectionEnd
328
329SectionGroup /e "User interfaces" SecGrpUI
330    ${MementoUnselectedSection} "Command Line" SecUiCli
331        SectionIn 2
332        SetOutPath $INSTDIR
333        SetOverwrite on
334        ${File} ${ADM_DIR}/avidemux_cli.exe
335        ${File} ${ADM_DIR}/libADM_render6_cli.dll
336        ${File} ${ADM_DIR}/libADM_UI_Cli6.dll
337    ${MementoSectionEnd}
338
339    ${MementoSection} Qt SecUiQt
340	SectionIn 1 2 RO
341        SetOutPath $INSTDIR
342        SetOverwrite on
343        ${File} ${ADM_DIR}/avidemux.exe
344        ${File} ${ADM_DIR}/avidemux_jobs.exe
345        ${File} ${ADM_DIR}/libADM_render6_QT4.dll
346        ${File} ${ADM_DIR}/libADM_UIQT46.dll
347        ${File} ${QT_DIR}/QtOpenGL4.dll
348    ${MementoSectionEnd}
349SectionGroupEnd
350
351SectionGroup "Audio Decoders" SecGrpAudioDecoder
352	${MementoSection} "�-law" SecAudDecUlaw
353		SectionIn 1 2
354		SetOverwrite on
355		SetOutPath $INSTDIR\plugins\audioDecoder
356		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ulaw.dll
357	${MementoSectionEnd}
358	${MementoSection} "AAC (FAAD)" SecAudDecFaad
359		SectionIn 1 2
360		SetOverwrite on
361		SetOutPath $INSTDIR\plugins\audioDecoder
362		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_faad.dll
363		#SetOutPath $INSTDIR
364	${MementoSectionEnd}
365	${MementoSection} "AAC, AC-3, ADPCM IMA AMV, DTS, E-AC-3, MP2, MP3, Nellymoser, QDesign, WMA (libavcodec)" SecAudDecAvcodec
366		SectionIn 1 2
367		SetOverwrite on
368		SetOutPath $INSTDIR\plugins\audioDecoder
369		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_lav.dll
370	${MementoSectionEnd}
371	${MementoSection} "AC-3 (liba52)" SecAudDecA52
372		SectionIn 1 2
373		SetOverwrite on
374		SetOutPath $INSTDIR\plugins\audioDecoder
375		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_a52.dll
376	${MementoSectionEnd}
377	${MementoSection} "ADPCM IMA" SecAudDecImaAdpcm
378		SectionIn 1 2
379		SetOverwrite on
380		SetOutPath $INSTDIR\plugins\audioDecoder
381		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ima_adpcm.dll
382	${MementoSectionEnd}
383	${MementoSection} "ADPCM Microsoft" SecAudDecMsAdpcm
384		SectionIn 1 2
385		SetOverwrite on
386		SetOutPath $INSTDIR\plugins\audioDecoder
387		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ms_adpcm.dll
388	${MementoSectionEnd}
389	${MementoSection} "AMR-NB" SecAudDecOpencoreAmrNb
390		SectionIn 1 2
391		SetOverwrite on
392		SetOutPath $INSTDIR\plugins\audioDecoder
393		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrnb.dll
394		SetOutPath $INSTDIR
395		${File} ${ADM_SYSDIR}/libopencore-amrnb-*.dll
396	${MementoSectionEnd}
397	${MementoSection} "AMR-WB" SecAudDecOpencoreAmrWb
398		SectionIn 1 2
399		SetOverwrite on
400		SetOutPath $INSTDIR\plugins\audioDecoder
401		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrwb.dll
402		SetOutPath $INSTDIR
403		${File} ${ADM_SYSDIR}/libopencore-amrwb-*.dll
404	${MementoSectionEnd}
405	${MementoSection} "MP2, MP3 (MAD)" SecAudDecMad
406		SectionIn 1 2
407		SetOverwrite on
408		SetOutPath $INSTDIR\plugins\audioDecoder
409		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_Mad.dll
410	${MementoSectionEnd}
411	${MementoSection} "Vorbis" SecAudDecVorbis
412		SectionIn 1 2
413		SetOverwrite on
414		SetOutPath $INSTDIR\plugins\audioDecoder
415		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_vorbis.dll
416		SetOutPath $INSTDIR
417		${File} ${ADM_SYSDIR}/libogg-0.dll
418		${File} ${ADM_SYSDIR}/libvorbis-0.dll
419	${MementoSectionEnd}
420SectionGroupEnd
421SectionGroup "Audio Devices" SecGrpAudioDevice
422	${MementoSection} "Waveform" SecAudDevWaveform
423		SectionIn 1 2
424		SetOverwrite on
425		SetOutPath $INSTDIR\plugins\audioDevices
426		${File} ${ADM_DIR}/plugins/audioDevices/libADM_av_win32.dll
427	${MementoSectionEnd}
428SectionGroupEnd
429SectionGroup "Audio Encoders" SecGrpAudioEncoder
430	${MementoSection} "AAC (FAAC)" SecAudEncFaac
431		SectionIn 1 2
432		SetOverwrite on
433		SetOutPath $INSTDIR\plugins\audioEncoders
434		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_faac.dll
435		#SetOutPath $INSTDIR
436	${MementoSectionEnd}
437	${MementoSection} "AAC (libavcodec)" SecAudEncLavAac
438		SectionIn 1 2
439		SetOverwrite on
440		SetOutPath $INSTDIR\plugins\audioEncoders
441		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_aac.dll
442	${MementoSectionEnd}
443	${MementoSection} "AC-3 (Aften)" SecAudDecAften
444		SectionIn 1 2
445		SetOverwrite on
446		SetOutPath $INSTDIR\plugins\audioEncoders
447		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_aften.dll
448		SetOutPath $INSTDIR
449		${File} ${ADM_SYSDIR}/libaften.dll
450	${MementoSectionEnd}
451	${MementoSection} "AC-3 (libavcodec)" SecAudEncLavAc3
452		SectionIn 1 2
453		SetOverwrite on
454		SetOutPath $INSTDIR\plugins\audioEncoders
455		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_ac3.dll
456	${MementoSectionEnd}
457	#${MementoSection} "DTS (dcaenc)" SecAudDecDcaEnc
458		#SectionIn 1 2
459		#SetOverwrite on
460		#SetOutPath $INSTDIR\plugins\audioEncoders
461		#${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_dcaenc.dll
462		#SetOutPath $INSTDIR
463		#${File} libdcaenc-0.dll
464	#${MementoSectionEnd}
465	${MementoSection} "MP2 (libavcodec)" SecAudEncLavMp2
466		SectionIn 1 2
467		SetOverwrite on
468		SetOutPath $INSTDIR\plugins\audioEncoders
469		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_mp2.dll
470		SetOutPath $INSTDIR
471	${MementoSectionEnd}
472	#${MementoSection} "MP2 (TwoLAME)" SecAudEncTwoLame
473		#SectionIn 1 2
474		#SetOverwrite on
475		#SetOutPath $INSTDIR\plugins\audioEncoders
476		#${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_twolame.dll
477	#${MementoSectionEnd}
478	${MementoSection} "MP3" SecAudEncLame
479		SectionIn 1 2
480		SetOverwrite on
481		SetOutPath $INSTDIR\plugins\audioEncoders
482		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lame.dll
483		SetOutPath $INSTDIR
484		${File} ${ADM_SYSDIR}/libmp3lame-0.dll
485	${MementoSectionEnd}
486	${MementoSection} "PCM" SecAudEncPcm
487		SectionIn 1 2
488		SetOverwrite on
489		SetOutPath $INSTDIR\plugins\audioEncoders
490		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_pcm.dll
491	${MementoSectionEnd}
492	${MementoSection} "Vorbis" SecAudEncVorbis
493		SectionIn 1 2
494		SetOverwrite on
495		SetOutPath $INSTDIR\plugins\audioEncoders
496		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_vorbis.dll
497		SetOutPath $INSTDIR
498		${File} ${ADM_SYSDIR}/libogg-0.dll
499		${File} ${ADM_SYSDIR}/libvorbis-0.dll
500		${File} ${ADM_SYSDIR}/libvorbisenc-2.dll
501	${MementoSectionEnd}
502SectionGroupEnd
503SectionGroup "Avisynth" SecGrpAvisynth
504	${MementoUnselectedSection} "Avisynth Proxy" SecAvsProxy
505		SectionIn 2
506		SetOutPath $INSTDIR
507		SetOverwrite on
508		${File} ${ADM_SYSDIR}/avsproxy.exe
509		${File} ${ADM_SYSDIR}/avsproxy_gui.exe
510	${MementoSectionEnd}
511	${MementoUnselectedSection} "Avisynth Proxy Demuxer" SecDemuxAvisynth
512		SectionIn 2
513		SetOverwrite on
514		SetOutPath $INSTDIR\plugins\demuxers
515		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_avsproxy.dll
516	${MementoSectionEnd}
517SectionGroupEnd
518SectionGroup "Demuxers" SecGrpDemuxers
519	${MementoSection} "ASF" SecDemuxAsf
520		SectionIn 1 2
521		SetOverwrite on
522		SetOutPath $INSTDIR\plugins\demuxers
523		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_asf.dll
524	${MementoSectionEnd}
525	${MementoSection} "BMP, JPEG, PNG Images" SecDemuxImage
526		SectionIn 1 2
527		SetOverwrite on
528		SetOutPath $INSTDIR\plugins\demuxers
529		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_pic.dll
530	${MementoSectionEnd}
531	${MementoSection} "Flash Video" SecDemuxFlv
532		SectionIn 1 2
533		SetOverwrite on
534		SetOutPath $INSTDIR\plugins\demuxers
535		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_flv.dll
536	${MementoSectionEnd}
537	${MementoSection} "Matroska" SecDemuxMatroska
538		SectionIn 1 2
539		SetOverwrite on
540		SetOutPath $INSTDIR\plugins\demuxers
541		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_matroska.dll
542	${MementoSectionEnd}
543	${MementoSection} "MP4" SecDemuxMp4
544		SectionIn 1 2
545		SetOverwrite on
546		SetOutPath $INSTDIR\plugins\demuxers
547		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_mp4.dll
548	${MementoSectionEnd}
549	${MementoSection} "MPEG-PS" SecDemuxMpegPs
550		SectionIn 1 2
551		SetOverwrite on
552		SetOutPath $INSTDIR\plugins\demuxers
553		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_ps.dll
554	${MementoSectionEnd}
555	${MementoSection} "MPEG-TS" SecDemuxMpegTs
556		SectionIn 1 2
557		SetOverwrite on
558		SetOutPath $INSTDIR\plugins\demuxers
559		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_ts.dll
560	${MementoSectionEnd}
561	${MementoSection} "MXF" SecDemuxMxf
562		SectionIn 1 2
563		SetOverwrite on
564		SetOutPath $INSTDIR\plugins\demuxers
565		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_mxf.dll
566	${MementoSectionEnd}
567	${MementoSection} "OpenDML AVI" SecDemuxOpenDml
568		SectionIn 1 2
569		SetOverwrite on
570		SetOutPath $INSTDIR\plugins\demuxers
571		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_opendml.dll
572	${MementoSectionEnd}
573SectionGroupEnd
574SectionGroup "Muxers" SecGrpMuxers
575	${MementoSection} "Dummy [Raw Audio/Video]" SecMuxDummy
576		SectionIn 1 2
577		SetOverwrite on
578		SetOutPath $INSTDIR\plugins\muxers
579		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_dummy.dll
580	${MementoSectionEnd}
581	${MementoSection} "Flash Video" SecMuxLavFlv
582		SectionIn 1 2
583		SetOverwrite on
584		SetOutPath $INSTDIR\plugins\muxers
585		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_flv.dll
586	${MementoSectionEnd}
587	${MementoSection} "Matroska" SecMuxLavMatroska
588		SectionIn 1 2
589		SetOverwrite on
590		SetOutPath $INSTDIR\plugins\muxers
591		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_Mkv.dll
592	${MementoSectionEnd}
593	${MementoSection} "MP4 (libavcodec)" SecMuxLavMp4
594		SectionIn 1 2
595		SetOverwrite on
596		SetOutPath $INSTDIR\plugins\muxers
597		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4.dll
598	${MementoSectionEnd}
599	${MementoSection} "MP4 (MP4v2)" SecMuxMp4v2
600		SectionIn 1 2
601		SetOverwrite on
602		SetOutPath $INSTDIR\plugins\muxers
603		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4v2.dll
604	${MementoSectionEnd}
605	${MementoSection} "MPEG-PS" SecMuxLavMpegPs
606		SectionIn 1 2
607		SetOverwrite on
608		SetOutPath $INSTDIR\plugins\muxers
609		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_ffPS.dll
610	${MementoSectionEnd}
611	${MementoSection} "MPEG-TS" SecMuxLavMpegTs
612		SectionIn 1 2
613		SetOverwrite on
614		SetOutPath $INSTDIR\plugins\muxers
615		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_ffTS.dll
616	${MementoSectionEnd}
617	${MementoSection} "OpenDML AVI" SecMuxOpenDml
618		SectionIn 1 2
619		SetOverwrite on
620		SetOutPath $INSTDIR\plugins\muxers
621		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_avi.dll
622	${MementoSectionEnd}
623	${MementoSection} "Raw Video" SecMuxRaw
624		SectionIn 1 2
625		SetOverwrite on
626		SetOutPath $INSTDIR\plugins\muxers
627		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_raw.dll
628	${MementoSectionEnd}
629SectionGroupEnd
630SectionGroup "Script Engines" SecGrpScriptEngine
631	#${MementoSection} "QtScript" SecScriptQt
632		#SectionIn 1 2
633		#SetOverwrite on
634		#SetOutPath $INSTDIR
635		#${File} ${QT_DIR}/QtScript4.dll
636		#${File} ${QT_DIR}/QtScriptTools4.dll
637		#SetOutPath $INSTDIR\plugins\scriptEngines
638		#${File} ${ADM_DIR}/plugins/scriptEngines/libADM_script_qt.dll
639		#SetOutPath $INSTDIR\help\QtScript
640		#${Folder} help/QtScript
641	#${MementoSectionEnd}
642	${MementoSection} "Tinypy" SecScriptTinypy
643		SectionIn 1 2
644		SetOverwrite on
645		SetOutPath $INSTDIR\plugins\scriptEngines
646		${File} ${ADM_DIR}/plugins/scriptEngines/libADM_script_tinyPy.dll
647		SetOutPath $INSTDIR\plugins\autoScripts
648		${Folder} ${ADM_DIR}/plugins/autoScripts
649	${MementoSectionEnd}
650SectionGroupEnd
651#SectionGroup "Video Decoders" SecGrpVideoDecoder
652	#${MementoSection} "VP8" SecVidDecVpx
653		#SectionIn 1 2
654		#SetOverwrite on
655		#SetOutPath $INSTDIR\plugins\videoDecoders
656		#${File} ${ADM_DIR}/plugins/videoDecoders/libADM_vd_vpx.dll
657	#${MementoSectionEnd}
658#SectionGroupEnd
659SectionGroup "Video Encoders" SecGrpVideoEncoder
660	${MementoSection} "[Null]" SecVidEncNull
661		SectionIn 1 2
662		SetOverwrite on
663		SetOutPath $INSTDIR\plugins\videoEncoders
664		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_null.dll
665	${MementoSectionEnd}
666	${MementoSection} "Huffyuv, FFVHuff" SecVidEncLavHuffyuv
667		SectionIn 1 2
668		SetOverwrite on
669		SetOutPath $INSTDIR\plugins\videoEncoders
670		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_huff.dll
671	${MementoSectionEnd}
672	${MementoSection} "JPEG" SecVidEncLavJpeg
673		SectionIn 1 2
674		SetOverwrite on
675		SetOutPath $INSTDIR\plugins\videoEncoders
676		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_jpeg.dll
677	${MementoSectionEnd}
678	${MementoSection} "MPEG-2" SecVidEncLavMpeg2
679		SectionIn 1 2
680		SetOverwrite on
681		SetOutPath $INSTDIR\plugins\videoEncoders
682		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffMpeg2.dll
683	${MementoSectionEnd}
684	${MementoSection} "MPEG-4 ASP (libavcodec)" SecVidEncLavMpeg4asp
685		SectionIn 1 2
686		SetOverwrite on
687		SetOutPath $INSTDIR\plugins\videoEncoders
688		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffMpeg4.dll
689	${MementoSectionEnd}
690	${MementoSection} "MPEG-4 ASP (Xvid)" SecVidEncXvid
691		SectionIn 1 2
692		SetOverwrite on
693		SetOutPath $INSTDIR\plugins\videoEncoders
694		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_xvid4.dll
695		SetOutPath $INSTDIR
696		${File} ${ADM_SYSDIR}/xvidcore.dll
697	${MementoSectionEnd}
698	${MementoSection} "MPEG-4 AVC" SecVidEncX264
699		SectionIn 1 2
700		SetOverwrite on
701		SetOutPath $INSTDIR\plugins\videoEncoders
702		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_x264_other.dll
703
704		SetOutPath $INSTDIR\plugins\videoEncoders\qt4
705		${File} ${ADM_DIR}/plugins/videoEncoders/qt4/libADM_ve_x264_QT4.dll
706
707		SetOutPath $INSTDIR\plugins\pluginSettings\x264
708		${Folder} ${ADM_DIR}/plugins/pluginSettings/x264
709		SetOutPath $INSTDIR
710		${File} ${ADM_SYSDIR}/libx264-*.dll
711		#${File} ${ADM_SYSDIR}/pthreadGC2.dll
712	${MementoSectionEnd}
713        ${MementoSection} "MPEG-4 HEVC" SecVidEncX265
714		SectionIn 1 2
715		SetOverwrite on
716		SetOutPath $INSTDIR\plugins\videoEncoders
717		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_x265_other.dll
718
719		SetOutPath $INSTDIR\plugins\videoEncoders\qt4
720		${File} ${ADM_DIR}/plugins/videoEncoders/qt4/libADM_ve_x265_QT4.dll
721
722		SetOutPath $INSTDIR
723		${File} ${ADM_SYSDIR}/libx265*.dll
724		#${File} ${ADM_SYSDIR}/pthreadGC2.dll
725	${MementoSectionEnd}
726${MementoSection} "PNG" SecVidEncLavPng
727		SectionIn 1 2
728		SetOverwrite on
729		SetOutPath $INSTDIR\plugins\videoEncoders
730		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_png.dll
731	${MementoSectionEnd}
732	${MementoSection} "Sorenson Spark" SecVidEncSorenson
733		SectionIn 1 2
734		SetOverwrite on
735		SetOutPath $INSTDIR\plugins\videoEncoders
736		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffFlv1.dll
737	${MementoSectionEnd}
738	${MementoSection} "YV12" SecVidEncYv12
739		SectionIn 1 2
740		SetOverwrite on
741		SetOutPath $INSTDIR\plugins\videoEncoders
742		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_yv12.dll
743	${MementoSectionEnd}
744SectionGroupEnd
745SectionGroup "Video Filters" SecGrpVideoFilter
746	SectionGroup "Transform Filters" SecGrpVideoFilterTransform
747		${MementoSection} "Add Black Borders" SecVidFltBlackBorders
748			SectionIn 1 2
749			SetOverwrite on
750			SetOutPath $INSTDIR\plugins\videoFilters
751			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_addBorders.dll
752		${MementoSectionEnd}
753		${MementoSection} "Add Logo" SecVidFltLogo
754			SectionIn 1 2
755			SetOverwrite on
756			SetOutPath $INSTDIR\plugins\videoFilters
757			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_logo.dll
758		${MementoSectionEnd}
759		${MementoSection} "Blacken Borders" SecVidFltBlackenBorders
760			SectionIn 1 2
761			SetOverwrite on
762			SetOutPath $INSTDIR\plugins\videoFilters
763			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_blackenBorders.dll
764		${MementoSectionEnd}
765		${MementoSection} "Change FPS" SecVidFltChangeFps
766			SectionIn 1 2
767			SetOverwrite on
768			SetOutPath $INSTDIR\plugins\videoFilters
769			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_changeFps.dll
770		${MementoSectionEnd}
771		${MementoSection} "Crop" SecVidFltCrop
772			SectionIn 1 2
773			SetOverwrite on
774			SetOutPath $INSTDIR\plugins\videoFilters
775			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_CropCli.dll
776			SetOutPath $INSTDIR\plugins\videoFilters\qt4
777			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_cropQt4.dll
778		${MementoSectionEnd}
779		${MementoSection} "Fade" SecVidFltFade
780			SectionIn 1 2
781			SetOverwrite on
782			SetOutPath $INSTDIR\plugins\videoFilters
783			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_fadeToBlack.dll
784		${MementoSectionEnd}
785		${MementoSection} "Greyscale" SecVidFltLumaOnly
786			SectionIn 1 2
787			SetOverwrite on
788			SetOutPath $INSTDIR\plugins\videoFilters
789			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_lumaOnly.dll
790		${MementoSectionEnd}
791		${MementoSection} "Horizontal Flip" SecVidFltHorizontalFlip
792			SectionIn 1 2
793			SetOverwrite on
794			SetOutPath $INSTDIR\plugins\videoFilters
795			${File} ${ADM_DIR}/plugins/videoFilters/libADM_hf_hflip.dll
796		${MementoSectionEnd}
797		${MementoSection} "libswscale Resize" SecVidFltSwscaleResize
798			SectionIn 1 2
799			SetOverwrite on
800			SetOutPath $INSTDIR\plugins\videoFilters
801			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_swscaleResize_cli.dll
802			SetOutPath $INSTDIR\plugins\videoFilters\qt4
803			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_swscaleResizeQT4.dll
804		${MementoSectionEnd}
805		${MementoSection} "Resample FPS" SecVidFltResampleFps
806			SectionIn 1 2
807			SetOverwrite on
808			SetOutPath $INSTDIR\plugins\videoFilters
809			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_resampleFps.dll
810		${MementoSectionEnd}
811		${MementoSection} "Rotate" SecVidFltRotate
812			SectionIn 1 2
813			SetOverwrite on
814			SetOutPath $INSTDIR\plugins\videoFilters
815			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_rotate.dll
816		${MementoSectionEnd}
817		${MementoSection} "Vertical Flip" SecVidFltVerticalFlip
818			SectionIn 1 2
819			SetOverwrite on
820			SetOutPath $INSTDIR\plugins\videoFilters
821			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_vflip.dll
822		${MementoSectionEnd}
823	SectionGroupEnd
824	SectionGroup "Interlacing Filters" SecGrpVideoFilterInterlacing
825		${MementoSection} "Decomb Decimate" SecVidFltDecombDecimate
826			SectionIn 1 2
827			SetOverwrite on
828			SetOutPath $INSTDIR\plugins\videoFilters
829			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_decimate.dll
830		${MementoSectionEnd}
831		${MementoSection} "Decomb Telecide" SecVidFltDecombTelecide
832			SectionIn 1 2
833			SetOverwrite on
834			SetOutPath $INSTDIR\plugins\videoFilters
835			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_telecide.dll
836		${MementoSectionEnd}
837		${MementoSection} "DGBob" SecVidFltDgbob
838			SectionIn 1 2
839			SetOverwrite on
840			SetOutPath $INSTDIR\plugins\videoFilters
841			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_DgBob.dll
842		${MementoSectionEnd}
843		${MementoSection} "Horizontal Stack Fields" SecVidFltHzStackFields
844			SectionIn 1 2
845			SetOverwrite on
846			SetOutPath $INSTDIR\plugins\videoFilters
847			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_hzstackField.dll
848		${MementoSectionEnd}
849		${MementoSection} "Kernel Deint" SecVidFltKernelDeint
850			SectionIn 1 2
851			SetOverwrite on
852			SetOutPath $INSTDIR\plugins\videoFilters
853			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_kernelDeint.dll
854		${MementoSectionEnd}
855		${MementoSection} "libavcodec Deinterlacers" SecVidFltLavDeinterlacers
856			SectionIn 1 2
857			SetOverwrite on
858			SetOutPath $INSTDIR\plugins\videoFilters
859			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_lavDeint.dll
860		${MementoSectionEnd}
861		${MementoSection} "Merge Fields" SecVidFltMergeFields
862			SectionIn 1 2
863			SetOverwrite on
864			SetOutPath $INSTDIR\plugins\videoFilters
865			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_mergeField.dll
866		${MementoSectionEnd}
867		${MementoSection} "Separate Fields" SecVidFltSeparateFields
868			SectionIn 1 2
869			SetOverwrite on
870			SetOutPath $INSTDIR\plugins\videoFilters
871			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_separateField.dll
872		${MementoSectionEnd}
873		${MementoSection} "Stack Fields" SecVidFltStackFields
874			SectionIn 1 2
875			SetOverwrite on
876			SetOutPath $INSTDIR\plugins\videoFilters
877			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_stackField.dll
878		${MementoSectionEnd}
879		${MementoSection} "Unstack Fields" SecVidFltUnstackFields
880			SectionIn 1 2
881			SetOverwrite on
882			SetOutPath $INSTDIR\plugins\videoFilters
883			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_unstackField.dll
884		${MementoSectionEnd}
885		${MementoSection} "Yadif" SecVidFltYadif
886			SectionIn 1 2
887			SetOverwrite on
888			SetOutPath $INSTDIR\plugins\videoFilters
889			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_yadif.dll
890		${MementoSectionEnd}
891	SectionGroupEnd
892	SectionGroup "Colour Filters" SecGrpVideoFilterColour
893		${MementoSection} "Avisynth Colour YUV" SecVidFltAvisynthColourYuv
894			SectionIn 1 2
895			SetOverwrite on
896			SetOutPath $INSTDIR\plugins\videoFilters
897			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_colorYuv.dll
898		${MementoSectionEnd}
899		${MementoSection} "ChromaShift" SecVidFltChromaShift
900			SectionIn 1 2
901			SetOverwrite on
902			SetOutPath $INSTDIR\plugins\videoFilters
903			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_chromaShiftCli.dll
904			SetOutPath $INSTDIR\plugins\videoFilters\qt4
905			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_chromaShiftQt4.dll
906		${MementoSectionEnd}
907		${MementoSection} "Contrast" SecVidFltContrast
908			SectionIn 1 2
909			SetOverwrite on
910			SetOutPath $INSTDIR\plugins\videoFilters
911			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_contrastCli.dll
912			SetOutPath $INSTDIR\plugins\videoFilters\qt4
913			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_contrastQt4.dll
914		${MementoSectionEnd}
915		${MementoSection} "MPlater Eq2" SecVidFltMplayerEq2
916			SectionIn 1 2
917			SetOverwrite on
918			SetOutPath $INSTDIR\plugins\videoFilters
919			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_eq2Cli.dll
920			SetOutPath $INSTDIR\plugins\videoFilters\qt4
921			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_eq2Qt4.dll
922		${MementoSectionEnd}
923		${MementoSection} "MPlater Hue" SecVidFltMplayerHue
924			SectionIn 1 2
925			SetOverwrite on
926			SetOutPath $INSTDIR\plugins\videoFilters
927			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_HueCli.dll
928			SetOutPath $INSTDIR\plugins\videoFilters\qt4
929			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_HueQt4.dll
930		${MementoSectionEnd}
931		${MementoSection} "Remove Plane" SecVidFltRemovePlane
932			SectionIn 1 2
933			SetOverwrite on
934			SetOutPath $INSTDIR\plugins\videoFilters
935			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_removePlane.dll
936		${MementoSectionEnd}
937		${MementoSection} "Swap U and V" SecVidFltSwapUandV
938			SectionIn 1 2
939			SetOverwrite on
940			SetOutPath $INSTDIR\plugins\videoFilters
941			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_swapUV.dll
942		${MementoSectionEnd}
943	SectionGroupEnd
944	SectionGroup "Noise Filters" SecGrpVideoFilterNoise
945		${MementoSection} "FluxSmooth" SecVidFltFluxSmooth
946			SectionIn 1 2
947			SetOverwrite on
948			SetOutPath $INSTDIR\plugins\videoFilters
949			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_FluxSmooth.dll
950		${MementoSectionEnd}
951		${MementoSection} "Gaussian Convolution" SecVidFltGauss
952			SectionIn 1 2
953			SetOverwrite on
954			SetOutPath $INSTDIR\plugins\videoFilters
955			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_gauss.dll
956		${MementoSectionEnd}
957		${MementoSection} "Large Median (5x5)" SecVidFltMediam5x5
958			SectionIn 1 2
959			SetOverwrite on
960			SetOutPath $INSTDIR\plugins\videoFilters
961			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_largeMedian.dll
962		${MementoSectionEnd}
963		${MementoSection} "Mean Convolution" SecVidFltMean
964			SectionIn 1 2
965			SetOverwrite on
966			SetOutPath $INSTDIR\plugins\videoFilters
967			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_mean.dll
968		${MementoSectionEnd}
969		${MementoSection} "Median Convolution" SecVidFltMedian
970			SectionIn 1 2
971			SetOverwrite on
972			SetOutPath $INSTDIR\plugins\videoFilters
973			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_median.dll
974		${MementoSectionEnd}
975		${MementoSection} "MPlayer Denoise 3D" SecVidFltMPlayerDenoise3d
976			SectionIn 1 2
977			SetOverwrite on
978			SetOutPath $INSTDIR\plugins\videoFilters
979			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_denoise3d.dll
980		${MementoSectionEnd}
981		${MementoSection} "MPlayer Denoise 3D HQ" SecVidFltMPlayerDenoise3dHq
982			SectionIn 1 2
983			SetOverwrite on
984			SetOutPath $INSTDIR\plugins\videoFilters
985			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_denoise3dhq.dll
986		${MementoSectionEnd}
987		${MementoSection} "MSharpen" SecVidFltMSharpen
988			SectionIn 1 2
989			SetOverwrite on
990			SetOutPath $INSTDIR\plugins\videoFilters
991			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_msharpen.dll
992		${MementoSectionEnd}
993	SectionGroupEnd
994	SectionGroup "Sharpness Filters" SecGrpVideoFilterSharpness
995		${MementoSection} "asharp" SecVidFltAsharp
996			SectionIn 1 2
997			SetOverwrite on
998			SetOutPath $INSTDIR\plugins\videoFilters\qt4
999			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_asharpQt4.dll
1000		${MementoSectionEnd}
1001		${MementoSection} "MPlayer Delogo" SecVidFltMPlayerDelogo
1002			SectionIn 1 2
1003			SetOverwrite on
1004			SetOutPath $INSTDIR\plugins\videoFilters\qt4
1005			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_mpdelogoQt4.dll
1006		${MementoSectionEnd}
1007		${MementoSection} "Sharpen" SecVidFltSharpen
1008			SectionIn 1 2
1009			SetOverwrite on
1010			SetOutPath $INSTDIR\plugins\videoFilters
1011			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sharpen.dll
1012		${MementoSectionEnd}
1013	SectionGroupEnd
1014	SectionGroup "Subtitle Filters" SecGrpVideoFilterSubtitle
1015		${MementoSection} "ASS, SSA" SecVidFltAssSsa
1016			SectionIn 1 2
1017			SetOverwrite on
1018			SetOutPath $INSTDIR\plugins\videoFilters
1019			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_ssa.dll
1020			SetOutPath $INSTDIR
1021			${File} ${ADM_SYSDIR}/libfribidi-0.dll
1022			${File} ${ADM_SYSDIR}/libiconv-2.dll
1023			${File} ${ADM_SYSDIR}/libfreetype-6.dll
1024			${File} ${ADM_SYSDIR}/libfontconfig-1.dll
1025			${File} ${ADM_SYSDIR}/libexpat-1.dll
1026			SetOutPath $INSTDIR\etc\fonts
1027			${Folder} ${ADM_DIR}/etc/fonts
1028		${MementoSectionEnd}
1029	SectionGroupEnd
1030	#SectionGroup "OpenGL Filters" SecGrpVideoFilterOpenGl
1031		#${MementoSection} "Fragment Shader" SecVidFltOpenGlFragmentShader
1032			#SectionIn 1 2
1033			#SetOverwrite on
1034			#SetOutPath $INSTDIR\plugins\videoFilters
1035			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sampleGlFrag2.dll
1036		#${MementoSectionEnd}
1037		#${MementoSection} "Read Back Benchmark" SecVidFltOpenGlReadBack
1038			#SectionIn 1 2
1039			#SetOverwrite on
1040			#SetOutPath $INSTDIR\plugins\videoFilters
1041			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_glBenchmark.dll
1042		#${MementoSectionEnd}
1043		#${MementoSection} "Resize" SecVidFltOpenGlResize
1044			#SectionIn 1 2
1045			#SetOverwrite on
1046			#SetOutPath $INSTDIR\plugins\videoFilters
1047			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_glResize.dll
1048		#${MementoSectionEnd}
1049		#${MementoSection} "Rotate" SecVidFltOpenGlRotate
1050			#SectionIn 1 2
1051			#SetOverwrite on
1052			#SetOutPath $INSTDIR\plugins\videoFilters
1053			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_rotateGlFrag2.dll
1054		#${MementoSectionEnd}
1055		#${MementoSection} "Wave" SecVidFltOpenGlWave
1056			#SectionIn 1 2
1057			#SetOverwrite on
1058			#SetOutPath $INSTDIR\plugins\videoFilters
1059			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sampleGlVertex.dll
1060		#${MementoSectionEnd}
1061	#SectionGroupEnd
1062	SectionGroup "Miscellaneous Filters" SecGrpVideoFilterMiscellaneous
1063		${MementoSection} "Print Information" SecVidFltPrintInfo
1064			SectionIn 1 2
1065			SetOverwrite on
1066			SetOutPath $INSTDIR\plugins\videoFilters
1067			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_printInfo.dll
1068		${MementoSectionEnd}
1069	SectionGroupEnd
1070SectionGroupEnd
1071
1072${MementoSection} "-Start menu Change Log" SecStartMenuChangeLog
1073    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1074    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1075    SetOutPath $INSTDIR
1076    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Change Log ${CORE_VERSION}.lnk" "$INSTDIR\Change Log.html"
1077    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Avidemux job control.lnk" $INSTDIR\avidemux_jobs.exe
1078    !insertmacro MUI_STARTMENU_WRITE_END
1079${MementoSectionEnd}
1080
1081
1082${MementoSection} "-Start menu Qt" SecStartMenuQt
1083    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1084    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1085    SetOutPath $INSTDIR
1086    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1087    !insertmacro MUI_STARTMENU_WRITE_END
1088${MementoSectionEnd}
1089
1090${MementoSection} "-Start menu AVS Proxy GUI" SecStartMenuAvsProxyGui
1091    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1092    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1093    SetOutPath $INSTDIR
1094    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\AVS Proxy GUI ${CORE_VERSION}.lnk" "$INSTDIR\avsproxy_gui.exe"
1095    !insertmacro MUI_STARTMENU_WRITE_END
1096${MementoSectionEnd}
1097
1098
1099${MementoSection} "-Quick Launch Qt" SecQuickLaunchQt
1100    SetOutPath $INSTDIR
1101    CreateShortcut "$QUICKLAUNCH\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1102${MementoSectionEnd}
1103
1104
1105${MementoSection} "-Desktop Qt" SecDesktopQt
1106    SetOutPath $INSTDIR
1107    CreateShortcut "$DESKTOP\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1108${MementoSectionEnd}
1109
1110${MementoSectionDone}
1111
1112Section -post SecUninstaller
1113    SectionIn 1 2
1114    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
1115    WriteRegStr HKLM "${REGKEY}" Version ${PRODUCT_VERSION}
1116    SetOutPath $INSTDIR
1117    WriteUninstaller $INSTDIR\uninstall.exe
1118    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayName "${SHORTCUT_NAME}"
1119    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayVersion "${PRODUCT_VERSION}"
1120    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayIcon $INSTDIR\uninstall.exe
1121    WriteRegStr HKLM "${UNINST_REGKEY}" UninstallString $INSTDIR\uninstall.exe
1122    WriteRegDWORD HKLM "${UNINST_REGKEY}" NoModify 1
1123    WriteRegDWORD HKLM "${UNINST_REGKEY}" NoRepair 1
1124SectionEnd
1125
1126Section -CloseLogFile
1127	FileClose $UninstallLogHandle
1128	SetFileAttributes ${UninstallLogPath} HIDDEN
1129SectionEnd
1130
1131Section Uninstall
1132	!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
1133
1134
1135    Delete /REBOOTOK "$QUICKLAUNCH\${SHORTCUT_NAME}.lnk"
1136    Delete /REBOOTOK "$DESKTOP\${SHORTCUT_NAME}.lnk"
1137    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${SHORTCUT_NAME}.lnk"
1138    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Avidemux job control.lnk"
1139    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Change Log ${CORE_VERSION}.lnk"
1140    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\AVS Proxy GUI ${CORE_VERSION}.lnk"
1141    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
1142    DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
1143
1144    DeleteRegKey HKLM "${UNINST_REGKEY}"
1145    DeleteRegValue HKLM "${REGKEY}" Path
1146	DeleteRegValue HKLM "${REGKEY}" CreateDesktopIcon
1147	DeleteRegValue HKLM "${REGKEY}" CreateStartMenuGroup
1148	DeleteRegValue HKLM "${REGKEY}" CreateQuickLaunchIcon
1149    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
1150
1151	FileOpen $UninstallLogHandle "${UninstallLogPath}" r
1152UninstallLoop:
1153    ClearErrors
1154    FileRead $UninstallLogHandle $R0
1155    IfErrors UninstallEnd
1156	Push $R0
1157    Call un.TrimNewLines
1158    Pop $R0
1159    Delete "$R0"
1160    Goto UninstallLoop
1161UninstallEnd:
1162	FileClose $UninstallLogHandle
1163	Delete "${UninstallLogPath}"
1164	Delete "$INSTDIR\uninstall.exe"
1165	Push "\"
1166	Call un.RemoveEmptyDirs
1167	RMDir "$INSTDIR"
1168SectionEnd
1169
1170##########################
1171# Installer functions
1172##########################
1173Function .onInit
1174UAC_Elevate:
1175	!insertmacro UAC_RunElevated
1176	StrCmp 1223 $0 UAC_ElevationAborted
1177	StrCmp 0 $0 0 UAC_Err
1178	StrCmp 1 $1 0 UAC_Success
1179	Quit
1180
1181UAC_Err:
1182	MessageBox MB_ICONSTOP "Unable to elevate, error $0"
1183	Abort
1184
1185UAC_ElevationAborted:
1186	Abort
1187
1188UAC_Success:
1189	StrCmp 1 $3 +4
1190	StrCmp 3 $1 0 UAC_ElevationAborted
1191	MessageBox MB_ICONSTOP "This installer requires admin access."
1192	Goto UAC_Elevate
1193
1194	Call LoadPreviousSettings
1195	ReadRegStr $PreviousVersion HKLM "${REGKEY}" Version
1196
1197	${If} $PreviousVersion != ""
1198		${VersionCompare} ${PRODUCT_VERSION} $PreviousVersion $PreviousVersionState
1199	${EndIf}
1200
1201    InitPluginsDir
1202    SetShellVarContext all
1203FunctionEnd
1204
1205Function .onInstSuccess
1206	${MementoSectionSave}
1207FunctionEnd
1208
1209Function LoadPreviousSettings
1210    ${MementoSectionRestore}
1211	!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
1212
1213	ReadRegStr $CreateStartMenuGroup HKLM "${REGKEY}" CreateStartMenuGroup
1214
1215	${If} $CreateStartMenuGroup == ""
1216		StrCpy $CreateStartMenuGroup 1
1217	${EndIf}
1218
1219	ReadRegStr $CreateDesktopIcon HKLM "${REGKEY}" CreateDesktopIcon
1220
1221	${If} $CreateDesktopIcon == ""
1222		StrCpy $CreateDesktopIcon 1
1223	${EndIf}
1224
1225	${If} ${AtMostWinVista}
1226		ReadRegStr $CreateQuickLaunchIcon HKLM "${REGKEY}" CreateQuickLaunchIcon
1227
1228		${If} $CreateQuickLaunchIcon == ""
1229			StrCpy $CreateQuickLaunchIcon 1
1230		${EndIf}
1231	${EndIf}
1232
1233FunctionEnd
1234
1235Function RunUninstaller
1236    ReadRegStr $R1  HKLM "${UNINST_REGKEY}" "UninstallString"
1237
1238	${If} $R1 == ""
1239		Return
1240	${EndIf}
1241
1242	;Run uninstaller
1243	HideWindow
1244	ClearErrors
1245
1246	${If} $PreviousVersionState == 0
1247	${AndIf} $ReinstallUninstall == 1
1248		ExecWait '$R1 _?=$INSTDIR'
1249	${Else}
1250		ExecWait '$R1 /frominstall _?=$INSTDIR'
1251	${EndIf}
1252
1253	IfErrors NoRemoveUninstaller
1254	IfFileExists "$INSTDIR\uninstall.exe" 0 NoRemoveUninstaller
1255		Delete "$R1"
1256		RMDir $INSTDIR
1257
1258NoRemoveUninstaller:
1259FunctionEnd
1260
1261Function CheckSelectedUIs
1262	!insertmacro SectionFlagIsSet ${SecGrpUI} ${SF_SELECTED} end checkPartial
1263checkPartial:
1264	!insertmacro SectionFlagIsSet ${SecGrpUI} ${SF_PSELECTED} end displayError
1265displayError:
1266    MessageBox MB_OK|MB_ICONSTOP "At least one User Interface must be selected."
1267    Abort
1268end:
1269FunctionEnd
1270
1271LangString INSTALL_OPTS_PAGE_TITLE ${LANG_ENGLISH} "Choose Install Options"
1272LangString INSTALL_OPTS_PAGE_SUBTITLE ${LANG_ENGLISH} "Choose where to install Avidemux icons."
1273Var dlgInstallOptions
1274Var lblCreateIcons
1275Var chkDesktop
1276Var chkStartMenu
1277Var chkQuickLaunch
1278
1279Function InstallOptionsPage
1280	Call IsInstallOptionsRequired
1281	!insertmacro MUI_HEADER_TEXT "$(INSTALL_OPTS_PAGE_TITLE)" "$(INSTALL_OPTS_PAGE_SUBTITLE)"
1282
1283	nsDialogs::Create 1018
1284	Pop $dlgInstallOptions
1285
1286	${If} $dlgInstallOptions == error
1287		Abort
1288	${EndIf}
1289
1290	${NSD_CreateLabel} 0 0u 100% 12u "Create icons for Avidemux:"
1291	Pop $lblCreateIcons
1292
1293	${NSD_CreateCheckBox} 0 18u 100% 12u "On my &Desktop"
1294	Pop $chkDesktop
1295	${NSD_SetState} $chkDesktop $CreateDesktopIcon
1296	${NSD_OnClick} $chkDesktop UpdateInstallOptions
1297
1298	${NSD_CreateCheckBox} 0 36u 100% 12u "In my &Start Menu Programs folder"
1299	Pop $chkStartMenu
1300	${NSD_SetState} $chkStartMenu $CreateStartMenuGroup
1301	${NSD_OnClick} $chkStartMenu UpdateInstallOptions
1302
1303	${If} ${AtMostWinVista}
1304		${NSD_CreateCheckBox} 0 54u 100% 12u "In my &Quick Launch bar"
1305		Pop $chkQuickLaunch
1306		${NSD_SetState} $chkQuickLaunch $CreateQuickLaunchIcon
1307		${NSD_OnClick} $chkQuickLaunch UpdateInstallOptions
1308	${EndIf}
1309  	#${If} ${IsWin2003}
1310		#WriteRegStr HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\avidemux.exe" "WIN2000"
1311	#${EndIf}
1312  	#${If} ${IsWinXp}
1313		#WriteRegStr HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\avidemux.exe" "WIN2000"
1314	#${EndIf}
1315	nsDialogs::Show
1316FunctionEnd
1317
1318Function UpdateInstallOptions
1319	${NSD_GetState} $chkDesktop $CreateDesktopIcon
1320	${NSD_GetState} $chkStartMenu $CreateStartMenuGroup
1321	${NSD_GetState} $chkQuickLaunch $CreateQuickLaunchIcon
1322FunctionEnd
1323
1324Function IsInstallOptionsRequired
1325Goto end
1326	!insertmacro SectionFlagIsSet ${SecUiQt} ${SF_SELECTED} end resetOptions
1327resetOptions:
1328
1329    StrCpy $CreateDesktopIcon 0
1330    StrCpy $CreateStartMenuGroup 0
1331    StrCpy $CreateQuickLaunchIcon 0
1332    Abort
1333
1334end:
1335FunctionEnd
1336
1337Function IsStartMenuRequired
1338    StrCmp $CreateStartMenuGroup 1 +2
1339        Abort
1340FunctionEnd
1341
1342Function ActivateInternalSections
1343    #AVS Proxy GUI shortcut:
1344    SectionGetFlags ${SecAvsProxy} $0
1345    IntOp $0 $0 & ${SF_SELECTED}
1346    IntOp $0 $0 & $CreateStartMenuGroup
1347    SectionSetFlags ${SecStartMenuAvsProxyGui} $0
1348
1349    #Change Log shortcut:
1350    SectionSetFlags ${SecStartMenuChangeLog} $CreateStartMenuGroup
1351
1352    #Qt shortcuts:
1353    SectionGetFlags ${SecUiQt} $0
1354    IntOp $0 $0 & ${SF_SELECTED}
1355
1356    IntOp $1 $0 & $CreateDesktopIcon
1357    SectionSetFlags ${SecDesktopQt} $1
1358
1359    IntOp $1 $0 & $CreateQuickLaunchIcon
1360    SectionSetFlags ${SecQuickLaunchQt} $1
1361
1362    IntOp $1 $0 & $CreateStartMenuGroup
1363    SectionSetFlags ${SecStartMenuQt} $1
1364FunctionEnd
1365
1366Function InstFilesPageShow
1367	${If} $ReinstallUninstall != ""
1368		Call RunUninstaller
1369		BringToFront
1370	${EndIf}
1371FunctionEnd
1372
1373Function InstFilesPageLeave
1374	; Don't advance automatically if details expanded
1375	FindWindow $R0 "#32770" "" $HWNDPARENT
1376	GetDlgItem $R0 $R0 1016
1377	System::Call user32::IsWindowVisible(i$R0)i.s
1378	Pop $R0
1379
1380	StrCmp $R0 0 +2
1381	SetAutoClose false
1382FunctionEnd
1383
1384Function ConfigureFinishPage
1385
1386    SectionGetFlags ${SecUiQt} $0
1387    IntOp $0 $0 & ${SF_SELECTED}
1388    StrCmp $0 ${SF_SELECTED} end
1389
1390    DeleteINISec "$PLUGINSDIR\ioSpecial.ini" "Field 4"
1391
1392end:
1393FunctionEnd
1394
1395Function RunAvidemux
1396    SetOutPath $INSTDIR
1397
1398    SectionGetFlags ${SecUiQt} $0
1399    IntOp $0 $0 & ${SF_SELECTED}
1400
1401	!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\avidemux.exe" "" "" ""
1402
1403    Goto end
1404
1405
1406end:
1407FunctionEnd
1408
1409Var ReinstallUninstallButton
1410
1411Function ReinstallPage
1412	${If} $PreviousVersion == ""
1413		Abort
1414	${EndIf}
1415
1416	nsDialogs::Create /NOUNLOAD 1018
1417	Pop $0
1418
1419	${If} $PreviousVersionState == 1
1420		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_FULLNAME}."
1421		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "An older version of Avidemux is installed on your system.  Select the operation you want to perform and click Next to continue."
1422		Pop $R0
1423		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Upgrade Avidemux using previous settings (recommended)"
1424		Pop $ReinstallUninstallButton
1425		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
1426		Pop $R0
1427
1428		${If} $ReinstallUninstall == ""
1429			StrCpy $ReinstallUninstall 1
1430		${EndIf}
1431	${ElseIf} $PreviousVersionState == 2
1432		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_FULLNAME}."
1433		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "A newer version of Avidemux is already installed! It is not recommended that you downgrade to an older version. Select the operation you want to perform and click Next to continue."
1434		Pop $R0
1435		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Downgrade Avidemux using previous settings (recommended)"
1436		Pop $ReinstallUninstallButton
1437		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
1438		Pop $R0
1439
1440		${If} $ReinstallUninstall == ""
1441			StrCpy $ReinstallUninstall 1
1442		${EndIf}
1443	${ElseIf} $PreviousVersionState == 0
1444		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
1445		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "${PRODUCT_FULLNAME} is already installed. Select the operation you want to perform and click Next to continue."
1446		Pop $R0
1447		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Add/Remove/Reinstall components"
1448		Pop $R0
1449		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Uninstall Avidemux"
1450		Pop $ReinstallUninstallButton
1451
1452		${If} $ReinstallUninstall == ""
1453			StrCpy $ReinstallUninstall 2
1454		${EndIf}
1455	${Else}
1456		MessageBox MB_ICONSTOP "Unknown value of PreviousVersionState, aborting" /SD IDOK
1457		Abort
1458	${EndIf}
1459
1460	${If} $ReinstallUninstall == "1"
1461		SendMessage $ReinstallUninstallButton ${BM_SETCHECK} 1 0
1462	${Else}
1463		SendMessage $R0 ${BM_SETCHECK} 1 0
1464	${EndIf}
1465
1466	nsDialogs::Show
1467FunctionEnd
1468
1469Function ReinstallPageLeave
1470	SendMessage $ReinstallUninstallButton ${BM_GETCHECK} 0 0 $R0
1471
1472	${If} $R0 == 1
1473		; Option to uninstall old version selected
1474		StrCpy $ReinstallUninstall 1
1475	${Else}
1476		; Custom up/downgrade or add/remove/reinstall
1477		StrCpy $ReinstallUninstall 2
1478	${EndIf}
1479
1480	${If} $ReinstallUninstall == 1
1481		${If} $PreviousVersionState == 0
1482			Call RunUninstaller
1483			Quit
1484		${Else}
1485			; Need to reload defaults. User could have
1486			; chosen custom, change something, went back and selected
1487			; the express option.
1488			Call LoadPreviousSettings
1489		${EndIf}
1490	${EndIf}
1491FunctionEnd
1492
1493
1494##########################
1495# Uninstaller functions
1496##########################
1497Function un.onInit
1498	SetShellVarContext all
1499
1500UAC_Elevate:
1501	!insertmacro UAC_RunElevated
1502	StrCmp 1223 $0 UAC_ElevationAborted
1503	StrCmp 0 $0 0 UAC_Err
1504	StrCmp 1 $1 0 UAC_Success
1505	Quit
1506
1507UAC_Err:
1508	MessageBox MB_ICONSTOP "Unable to elevate, error $0"
1509	Abort
1510
1511UAC_ElevationAborted:
1512	Abort
1513
1514UAC_Success:
1515	StrCmp 1 $3 +4
1516	StrCmp 3 $1 0 UAC_ElevationAborted
1517	MessageBox MB_ICONSTOP "This installer requires admin access."
1518	Goto UAC_Elevate
1519FunctionEnd
1520
1521; TrimNewlines (copied from NSIS documentation)
1522; input, top of stack  (e.g. whatever$/r$/n)
1523; output, top of stack (replaces, with e.g. whatever)
1524; modifies no other variables.
1525Function un.TrimNewlines
1526	Exch $R0
1527	Push $R1
1528	Push $R2
1529	StrCpy $R1 0
1530
1531loop:
1532	IntOp $R1 $R1 - 1
1533	StrCpy $R2 $R0 1 $R1
1534	StrCmp $R2 "$\r" loop
1535	StrCmp $R2 "$\n" loop
1536	IntOp $R1 $R1 + 1
1537	IntCmp $R1 0 no_trim_needed
1538	StrCpy $R0 $R0 $R1
1539
1540no_trim_needed:
1541	Pop $R2
1542	Pop $R1
1543	Exch $R0
1544FunctionEnd
1545
1546Function un.RemoveEmptyDirs
1547	Pop $9
1548	!define Index 'Line${__LINE__}'
1549	FindFirst $0 $1 "$INSTDIR$9*"
1550	StrCmp $0 "" "${Index}-End"
1551"${Index}-Loop:"
1552	StrCmp $1 "" "${Index}-End"
1553	StrCmp $1 "." "${Index}-Next"
1554	StrCmp $1 ".." "${Index}-Next"
1555	Push $0
1556	Push $1
1557	Push $9
1558	Push "$9$1\"
1559	Call un.RemoveEmptyDirs
1560	Pop $9
1561	Pop $1
1562	Pop $0
1563;"${Index}-Remove:"
1564	RMDir "$INSTDIR$9$1"
1565"${Index}-Next:"
1566	FindNext $0 $1
1567	Goto "${Index}-Loop"
1568"${Index}-End:"
1569	FindClose $0
1570	!undef Index
1571FunctionEnd
1572
1573Function un.ConfirmPagePre
1574	${un.GetParameters} $R0
1575	${un.GetOptions} $R0 "/frominstall" $R1
1576	${Unless} ${Errors}
1577		Abort
1578	${EndUnless}
1579FunctionEnd
1580
1581Function un.FinishPagePre
1582	${un.GetParameters} $R0
1583	${un.GetOptions} $R0 "/frominstall" $R1
1584	${Unless} ${Errors}
1585		SetRebootFlag false
1586		Abort
1587	${EndUnless}
1588FunctionEnd
1589