"Fossies" - the Fresh Open Source Software Archive

Member "faac-1_30/plugins/cooledit/Faac.cpp" (16 Oct 2019, 3381 Bytes) of package /linux/misc/faac-1_30.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Faac.cpp" see the Fossies "Dox" file reference documentation.

    1 /*
    2 FAAC - codec plugin for Cooledit
    3 Copyright (C) 2002-2004 Antonio Foranna
    4 
    5 This program is free software; you can redistribute it and/or modify
    6 it under the terms of the GNU General Public License as published by
    7 the Free Software Foundation.
    8     
    9 This program is distributed in the hope that it will be useful,
   10 but WITHOUT ANY WARRANTY; without even the implied warranty of
   11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12 GNU General Public License for more details.
   13         
   14 You should have received a copy of the GNU General Public License
   15 along with this program; if not, write to the Free Software
   16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   17             
   18 The author can be contacted at:
   19 ntnfrn_email-temp@yahoo.it
   20 */
   21 
   22 #include <windows.h>
   23 #include "resource.h"
   24 #include "filters.h"    // CoolEdit
   25 #include "Defines.h"    // my defines
   26 #include "EncDialog.h"
   27 #include "Cfaac.h"
   28 
   29 
   30 
   31 // *********************************************************************************************
   32 
   33 
   34 
   35 inline DWORD ERROR_FGO(char *msg)
   36 {
   37     if(msg)
   38     {
   39     char buf[100];
   40         sprintf(buf,"FilterGetOptions: %s", msg);
   41         MessageBox(0, buf, APP_NAME " plugin", MB_OK|MB_ICONSTOP);
   42     }
   43     return 0;
   44 }
   45 // -----------------------------------------------------------------------------------------------
   46 
   47 DWORD FAR PASCAL FilterGetOptions(HWND hWnd, HINSTANCE hInst, long lSamprate, WORD wChannels, WORD wBitsPerSample, DWORD dwOptions)
   48 {
   49 long retVal=DialogBoxParam((HINSTANCE)hInst,(LPCSTR)MAKEINTRESOURCE(IDD_ENCODER), (HWND)hWnd, (DLGPROC)DIALOGMsgProcEnc, dwOptions);
   50 
   51     if(retVal==-1)
   52         /*return */ERROR_FGO("DialogBoxParam");
   53 
   54     return !retVal ? dwOptions : retVal;
   55 }
   56 // *********************************************************************************************
   57 
   58 // GetSuggestedSampleType() is called if OpenFilterOutput() returns NULL
   59 void FAR PASCAL GetSuggestedSampleType(LONG *lplSamprate, WORD *lpwBitsPerSample, WORD *wChannels)
   60 {
   61     *lplSamprate=0; // don't care
   62     *lpwBitsPerSample= *lpwBitsPerSample<=16 ? 0 : 16;
   63     *wChannels= *wChannels<49 ? 0 : 48;
   64 }
   65 // *********************************************************************************************
   66 
   67 void FAR PASCAL CloseFilterOutput(HANDLE hOutput)
   68 {
   69     if(!hOutput)
   70         return;
   71 
   72 Cfaac tmp(hOutput); // this line frees memory
   73 }              
   74 // *********************************************************************************************
   75 
   76 HANDLE FAR PASCAL OpenFilterOutput(LPSTR lpstrFilename,long lSamprate,WORD wBitsPerSample,WORD wChannels,long lSize, long far *lpChunkSize, DWORD dwOptions)
   77 {
   78 HANDLE  hOutput;
   79 Cfaac   tmp;
   80 CMyEncCfg   cfg(false);
   81 char    *srcFilename=tmp.getSourceFilename(cfg.TagSrcPath,lpstrFilename,cfg.TagSrcExt);
   82 
   83     if(hOutput=tmp.Init(srcFilename,lpstrFilename,lSamprate,wBitsPerSample,wChannels,lSize))
   84     {
   85     MYOUTPUT *mo;
   86         GLOBALLOCK(mo,hOutput,MYOUTPUT,return NULL);
   87         *lpChunkSize=mo->samplesInput*(wBitsPerSample>>3); // size of samplesInput
   88 
   89         GlobalUnlock(hOutput);
   90         tmp.hOutput=NULL;
   91     }
   92 
   93     FREE_ARRAY(srcFilename);
   94     return hOutput;
   95 }
   96 // *********************************************************************************************
   97 
   98 DWORD FAR PASCAL WriteFilterOutput(HANDLE hOutput, unsigned char far *bufIn, long lBytes)
   99 {
  100     if(!hOutput)
  101         return 0;
  102 
  103 Cfaac tmp;
  104 DWORD bytesWritten;
  105 
  106     bytesWritten=tmp.processData(hOutput,bufIn,lBytes);
  107     return bytesWritten ? bytesWritten : 0x7fffffff; // bytesWritten<=0 stops CoolEdit
  108 }