123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #ifndef _TRANSCODER_IMP_H_
- #define _TRANSCODER_IMP_H_
- #include <windows.h>
- #include <windowsx.h>
- #include "..\..\General\gen_ml/itemlist.h"
- #include "../winamp/wa_ipc.h"
- #include "..\..\General\gen_ml/ml.h"
- #include "DeviceView.h"
- #include "nu/AutoWide.h"
- #include "nu/AutoChar.h"
- #include "transcoder.h"
- #include "resource1.h"
- #include <wchar.h>
- #include <stdio.h>
- #include <vector>
- #define ENCODER_HIGHLY_PREFERRED 2
- #define ENCODER_PREFERRED 1
- #define ENCODER_NO_PREFERENCE 0
- #define ENCODER_NOT_PREFERRED -1
- #define ENCODER_DO_NOT_USE -2
- class EncodableFormat
- {
- public:
- unsigned int fourcc;
- wchar_t *desc;
- EncodableFormat(unsigned int fourcc,wchar_t *desc) :
- fourcc(fourcc)
- {
- this->desc = _wcsdup(desc);
- }
- ~EncodableFormat()
- {
- free(desc);
- }
- };
- typedef std::vector<EncodableFormat*> FormatList;
- class TranscoderImp : public Transcoder
- {
- protected:
- bool TranscoderDisabled;
- bool transrate;
- int transratethresh;
- bool translossless;
- wchar_t caption[100];
- wchar_t inifile[MAX_PATH];
- char inifileA[MAX_PATH];
- HINSTANCE hInst;
- HWND winampParent;
- HWND callbackhwnd;
- std::vector<unsigned int> outformats;
- FormatList formats;
- C_Config * config;
- convertFileStructW cfs;
- void (*callback)(void * callbackContext, wchar_t * status);
- void* callbackContext;
- bool convertDone;
- Device *device;
- void TranscodeProgress(int pc, bool done);
- bool StartTranscode(unsigned int destformat, wchar_t *inputFile, wchar_t *outputfile, bool test=false);
- void EndTranscode();
- bool TestTranscode(wchar_t * file, unsigned int destformat);
- bool FormatAcceptable(wchar_t * format);
- bool FormatAcceptable(unsigned int format);
- int GetOutputFormat(wchar_t * file, int *bitrate=NULL);
- void AddEncodableFormat(const char *desc, unsigned int fourcc);
- void ReloadConfig();
- public:
- TranscoderImp(HWND winampParent, HINSTANCE hInst, C_Config * config, Device *device);
- virtual ~TranscoderImp();
- virtual void LoadConfigProfile(wchar_t *profile);
- virtual void AddAcceptableFormat(wchar_t *format);
- virtual void AddAcceptableFormat(unsigned int format);
-
-
-
-
-
-
- virtual int CanTranscode(wchar_t *file, wchar_t *ext = NULL, int length = -1);
- virtual bool ShouldTranscode(wchar_t * file);
- virtual int TranscodeFile(wchar_t *inputFile, wchar_t *outputFile, int *killswitch, void (*callback)(void * callbackContext, wchar_t * status), void* callbackContext, wchar_t * caption=L"Transcoding %d%%");
-
-
-
-
-
- virtual void GetTempFilePath(const wchar_t *ext, wchar_t *filename);
-
- static void* ConfigureTranscoder(wchar_t * configProfile, HWND winampParent, C_Config * config, Device *dev);
- static BOOL transcodeconfig_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
- static void init();
- static void quit();
- friend LRESULT CALLBACK TranscodeMsgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
- };
- #endif
|