r_list.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #ifndef _R_LIST_H_
  25. #define _R_LIST_H_
  26. #include "avs_eelif.h"
  27. #define LIST_ID 0xfffffffe
  28. extern unsigned char blendtable[256][256];
  29. extern BOOL blendtableInited;
  30. class C_RenderTransitionClass;
  31. class C_UndoItem;
  32. class C_RenderListClass : public C_RBASE {
  33. friend C_RenderTransitionClass;
  34. public:
  35. typedef struct
  36. {
  37. C_RBASE *render;
  38. int effect_index;
  39. int has_rbase2;
  40. } T_RenderListType;
  41. protected:
  42. static char sig_str[];
  43. int *thisfb;
  44. int l_w, l_h;
  45. int isroot;
  46. int num_renders,num_renders_alloc;
  47. T_RenderListType *renders;
  48. int inblendval, outblendval;
  49. int bufferin, bufferout;
  50. int ininvert, outinvert;
  51. int use_code;
  52. RString effect_exp[2];
  53. int inited;
  54. NSEEL_CODEHANDLE codehandle[4];
  55. int need_recompile;
  56. CRITICAL_SECTION rcs;
  57. NSEEL_VMCTX AVS_EEL_CONTEXTNAME;
  58. double *var_beat, *var_alphain, *var_alphaout, *var_enabled, *var_clear, *var_w, *var_h;
  59. int isstart;
  60. int mode;
  61. int beat_render, beat_render_frames;
  62. int fake_enabled;
  63. #ifdef LASER
  64. C_LineListBase *line_save;
  65. #else
  66. void set_n_Context();
  67. void unset_n_Context();
  68. int nbw_save[NBUF],nbh_save[NBUF]; // these are our framebuffers
  69. void *nb_save[NBUF];
  70. int nbw_save2[NBUF],nbh_save2[NBUF]; // this are temp space for saving the global ones
  71. void *nb_save2[NBUF];
  72. int nsaved;
  73. #endif
  74. #define MAX_SMP_THREADS 8
  75. // smp stuff
  76. void smp_Render(int minthreads, C_RBASE2 *render, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  77. typedef struct
  78. {
  79. void *vis_data_ptr;
  80. int nthreads;
  81. int isBeat;
  82. int *framebuffer;
  83. int *fbout;
  84. int w;
  85. int h;
  86. C_RBASE2 *render;
  87. HANDLE hQuitHandle;
  88. HANDLE hThreads[MAX_SMP_THREADS];
  89. HANDLE hThreadSignalsStart[MAX_SMP_THREADS];
  90. HANDLE hThreadSignalsDone[MAX_SMP_THREADS];
  91. int threadTop;
  92. } _s_smp_parms;
  93. static _s_smp_parms smp_parms;
  94. static DWORD WINAPI smp_threadProc(LPVOID parm);
  95. public:
  96. static void smp_cleanupthreads();
  97. C_RenderListClass(int iroot=0);
  98. virtual ~C_RenderListClass();
  99. virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h);
  100. virtual HWND conf(HINSTANCE hInstance, HWND hwndParent);
  101. virtual void load_config(unsigned char *data, int len);
  102. virtual int save_config(unsigned char *data);
  103. virtual char *get_desc();
  104. int getNumRenders(void);
  105. T_RenderListType *getRender(int index);
  106. int findRender(T_RenderListType *r);
  107. int removeRender(int index, int del); // return 0 on success
  108. int removeRenderFrom(T_RenderListType *r, int del); // return 0 on success
  109. int insertRender(T_RenderListType *r, int index); // return -1 on failure, actual position on success
  110. int insertRenderBefore(T_RenderListType *r, T_RenderListType *before); // return -1 on failure, actual position on success
  111. void clearRenders(void);
  112. void freeBuffers();
  113. int __SavePreset(char *filename);
  114. int __LoadPreset(char *filename, int clear);
  115. int __SavePresetToUndo(C_UndoItem &item);
  116. int __LoadPresetFromUndo(C_UndoItem &item, int clear);
  117. int clearfb() { return mode&1; }
  118. void set_clearfb(int v) { if (v) mode|=1; else mode&=~1; }
  119. int blendin() { return ((mode>>8)&31); }
  120. void set_blendin(int v) { mode&=~(31<<8); mode|=(v&31)<<8; }
  121. int blendout() { return ((mode>>16)&31)^1; }
  122. void set_blendout(int v) { mode&=~(31<<16); mode|=((v^1)&31)<<16; }
  123. unsigned char get_extended_datasize(void) { return ((mode & 0xFF000000) >> 24); }
  124. void set_extended_datasize(unsigned char s) { mode &= 0xFFFFFF; mode |= s << 24; }
  125. int enabled() { return ((mode&2)^2) || fake_enabled>0; }
  126. void set_enabled(int v) { if (!v) mode|=2; else mode&=~2; }
  127. static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  128. static BOOL CALLBACK g_DlgProcRoot(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
  129. int save_config_ex(unsigned char *data, int rootsave);
  130. void load_config_code(unsigned char *data, int len);
  131. int save_config_code(unsigned char *data);
  132. void FillBufferCombo(HWND dlg, int ctl);
  133. };
  134. #endif // _R_LIST_H_