Beispiel #1
0
 // Constructor
 public VsWmvEncoder(long syncTimer)
     : base(syncTimer)
 {
     try
     {
         String vsAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
         vsEncoder = new WmvEncoder(Path.Combine(vsAppPath, "640x480.prx"), (ulong)(1000 / syncTimer));
     }
     catch (Exception err)
     {
         // error log
         logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
     }
 }
Beispiel #2
0
        public override void StartRecord()
        {
            // check if recording
            if (bRecord) return;

            if (vsEncoder == null)
            {
                try
                {
                    String vsAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0, 8));
                    vsEncoder = new WmvEncoder(Path.Combine(vsAppPath, "640x480.prx"), (ulong)(1000 / syncTimer));
                }
                catch (Exception err)
                {
                    // error log
                    logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);

                    // dispose encoder
                    DisposeEncoder();
                }
            }

            try
            {
                // check & create directory
                process_DirName();

                // create new file
                vsEncoder.StartRecord(aviName);

                // init encoder
                InitEncoder();

                // start counter
                StartCounter();

                // start record
                bRecord = true;
            }
            catch (Exception err)
            {
                // error log
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);

                // dispose encoder
                DisposeEncoder();
            }
        }
Beispiel #3
0
        public void DisposeEncoder()
        {
            bRecord = false;

            // stop encoder
            StopEncoder();

            try
            {
                // trace log
                logger.Log(LogLevel.Info, "DisposeEncoder : Before StopRecord/Dispose.");

                vsEncoder.StopRecord();
                vsEncoder.Dispose();
                vsEncoder = null;

                // trace log
                logger.Log(LogLevel.Info, "DisposeEncoder : After StopRecord/Dispose..");
            }
            catch (Exception err)
            {
                // error log
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);
            }
            finally
            {
                // start encoder
                StartEncoder();
            }
        }