home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / OutputManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  4.6 KB  |  171 lines

  1. /* 
  2.  *  OutputManager.h
  3.  *
  4.  *    Copyright (C) Alberto Vigata - January 2000
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24. #if !defined(AFX_OUTPUTMANAGER_H__4A6D4869_F64A_41A6_B12B_1B2A529DD8DF__INCLUDED_)
  25. #define AFX_OUTPUTMANAGER_H__4A6D4869_F64A_41A6_B12B_1B2A529DD8DF__INCLUDED_
  26.  
  27. #if _MSC_VER > 1000
  28. #pragma once
  29. #endif // _MSC_VER > 1000
  30.  
  31. #include "thread.h"
  32. #include "videosource.h"
  33. #include "progressdlg.h"
  34. #include "batchlist.h"
  35. #include "..\include\floutapi.h"
  36. #include "postprocessing.h"
  37. #include "profile.h"
  38.  
  39.  
  40. typedef struct tagTOutputManagerRunInfo
  41. {
  42.   batchlist *pJobList;
  43.   CProgressReport *pReport;
  44.   TProfile prof;
  45. }TOutputManagerRunInfo;
  46.  
  47. class COutputManager:public CProgressTracking, public CFlThread
  48. {
  49. public:
  50.   void ConfigureOutput(long nIndex);
  51.  
  52.   CVideoSource *GetSource(){ return m_pVideoSource; }
  53.     COutputManager();
  54.     virtual ~COutputManager();
  55.  
  56.   // The Run function
  57.   bool Run( TOutputManagerRunInfo *pRunInfo );
  58.  
  59.   // Progress Tracking stuff
  60.   void SetProgressPriority(ui32 nPriority)
  61.   { 
  62.     CFlAutoLock lock( &m_csConv );
  63.     if( m_bConvInProgress )
  64.     {
  65.       SetPriority(nPriority); 
  66.       if(m_pVideoSource) m_pVideoSource->SetPriority(nPriority);      
  67.     }
  68.   }
  69.   char *GetOutputFileName(){ return m_pOutputFileName; }
  70.   ui64 GetProcessed(){ return m_nConversionProcessed+m_nPartialProcessed; }
  71.   ui64 GetSize(){ return m_nConversionSize; }
  72.   ui32 GetJobCount(){ return m_oJobList.size(); }
  73.   ui32 GetJobInProcess(){ return m_nJobInProcess; }
  74.   ui32 GetPresentFrame() {return m_nFrameCount; }
  75.   void Cancel(){ m_evResumeCompile.Set(); m_evCancelCompile.Set(); m_evCompileCanceled.Wait(); }
  76.   void Pause(){ m_evResumeCompile.Reset(); m_evPauseCompile.Set(); }
  77.   void Resume(){ m_evResumeCompile.Set(); }
  78.   void DualPassInfo( bool &isDualPass, bool &IsFirstPass)
  79.   { IsFirstPass = m_bFirstPass; 
  80.     isDualPass = m_bIsDualPass; }
  81.   bool Terminated(){ return m_bTerminated; }
  82.   bool IsPaused(){ return !m_bIsRunning; }
  83.  
  84.   flreturn_t getstream(ui32 streamid, getstream_s *st);
  85.   flreturn_t getstream_report( ui32 streamid, getstream_report_s *st);
  86.  
  87.   flreturn_t getvideo(getvideo_s *gv);
  88.   flreturn_t getaudio(getaudio_s *ga);
  89.  
  90.   flreturn_t getvideo_report(getvideo_report_s *gvr);
  91.  
  92.   enum {
  93.     video=0,
  94.     audio
  95.   } streamid_t;
  96.  
  97.  
  98.  
  99.   // conversion variables
  100.   i64 m_nMyClock;
  101.   ui32 m_nFrameSpan;
  102.   ui32 m_nAudPrevFrame;
  103.   ui32 m_nAudSamplesPerFrame;
  104.   bool m_bImageWaiting;
  105.   bool m_bIsRunning;
  106.   bool m_bTerminated;
  107.   bool m_bConvInProgress;
  108.  
  109.   bool m_bFirstTime;
  110.  
  111.   // Some events
  112.   CFlEvent m_evCompileCanceled;
  113.   CFlEvent m_evCancelCompile;
  114.   CFlEvent m_evPauseCompile;
  115.   CFlEvent m_evResumeCompile;
  116.   CFlEvent m_evCompileTerminated;
  117.   
  118.   ui32 m_nFrameCount;
  119.  
  120.   // Static
  121.   CFrame *m_pFrameInProcess;
  122.   
  123.   CVideoSource *m_pVideoSource;
  124.  
  125. private:
  126.   bool StartJob( int nJobIndex );
  127.   void StopJob( int nJobIndex );
  128.  
  129.   bool StartInput( ui64 nStart, ui64 nStop );
  130.   bool StopInput();
  131.  
  132.   ui32 Convert();
  133.   // Actual running thread
  134.   DWORD ThreadProc();  
  135.   char *AddFileExtension(char *);
  136.   
  137.  
  138.   // conversion variables
  139.   bool m_bIsDualPass;
  140.   bool m_bFirstPass;
  141.   bool m_bInputStarted;
  142.   ui64 m_nStartPos, m_nStopPos;    // start, stop position for the current job
  143.   ui64 m_nConversionProcessed;
  144.   ui64 m_nPartialProcessed;
  145.   ui64 m_nConversionSize;
  146.   ui32 m_nJobInProcess;
  147.   ui32 m_nJobCount;
  148.  
  149.   // Postprocessing settings
  150.   TPPost m_pps;
  151.   TProfile m_prof;
  152.  
  153.   // Report of operations
  154.   CProgressReport *m_pReport;
  155.   TOutputManagerRunInfo m_sRunInfo;
  156.  
  157.   CListFrameBuffer *m_pDecodedFrameBuffer;
  158.   char m_pOutputFileName[1024];
  159.  
  160.   // Destination Frame
  161.   CFrame m_frDest;
  162.  
  163.   // Critical secion for conversion
  164.   CFlCritSec m_csConv;
  165.  
  166.   // Job list
  167.   batchlist m_oJobList;
  168. };
  169.  
  170. #endif // !defined(AFX_OUTPUTMANAGER_H__4A6D4869_F64A_41A6_B12B_1B2A529DD8DF__INCLUDED_)
  171.