This project is read-only.

ScapLIB ReadMe File


To use this library with your application, you must set the:

useLegacyV2RuntimeActivationPolicy flag to true. To set this setup an app.config for your application and make sure that it looks like this:

<?xml version="1.0"?>
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>

If you do not know how to setup an app.config, please refer to your IDE manual on how to do this. In VS Express 2010, you must add one from the general templet's tab of the add new item menu.

Another important note to make is that all of the .dll and .xml files located in the External-Files.rar download must be in the application directory at the same level as the ScapLIB and .exe file.

Sample Program:

Basic Setup in a WinForms application.


This library is split into three separate Main classes ScapCore, ScapCapture, and ScapBackendConfig. ScapCore and ScapBackendConfig are both static classes, these classes control and setup the capture framework. ScapCapture is the main data container for the capture framework.

ScapCore contains all of the methods for capture control such as, Start/Stop and Pause/Resume along with get capture status information.

ScapBackendConfig is the heart of the capture framework, this class must be setup using the ScapBackendSetup() method contained within. Once this has been set the capture is ready to go and can be started.
Disposing the BackendConfig will destroy all of the capture data so if you have not encoded or decompressed your data it will be lost.

ScapCapture contains the Data for the framework to work with. such as the capture area, frame rate and codec information. this is used to setup the framework for a capture, and then disposed.

There are a few Helper Classes that will not be extensively explained these are the internal Databank Class, the Internal FileIO class, and a few InterOp classes. These are not reachable outside the library and are only there for framework functions.

The Databank Class is the data container for a captured frame. The FileIO class conatins all unsafe pointer based File writing methods. The InterOp classes contain all relavant InterOp Data and Methods, these are mainly used for the main capture methods.

There is one other namespace which is used and that is the LZ4 Compression namespace this is used to compress the captured images to save on space and speed for the capture process.

Lastly there are two Helper Enums that are used to select Video and Image Formats. These enums are used in the ScapCapture Constructor and offer a variety of outputs.

ScapCore Methods:

  • StartCapture()
    • This Method Starts the predetermined capture, as well as the audio recording if it is enabled.
  • StopCapture()
    • This Method Stops the predetermined capture, including audio and sets up the capture for Decompression and encoding.
Only use the StopCapture() method when you are finished with that capture a new capture needs to be :: set if this method is called. Use the PauseCapture() method to stop a capture that you wish to later :: resume.
  • PauseCapture()
    • This Method temporarily stops a capture to be resumed with ResumeCapture().
  • ResumeCapture()
    • Used in conjunction of PauseCapture().
  • DecompressCapture(bool SaveCompressedFiles)
    • The bool argument sets whether or not to save the compressed image files to be decompressed later.
    • Decompress a stoped capture. This method takes the compressed frames that have been captured and saves them to which ever image codec that has been selected.
    • This method must be called before the encode method and only after a capture has been stoped.
  • EncodeCapture(bool SaveImages)
    • The bool argument saves or deletes the indivudal frame files.
    • This mehtod must be called once the decompression threads have completed. The GetDecompressionProgress() method to see if this is true.
  • CaptureSingleFrame/Array/Stream/Bitmap()
    • Captures a single frame of the screen and returns the selected output.
  • Decompress/Compress/SingleFrame()
    • To be used in CaptureSingleFrame/Array/Stream/Bitmap() if necesary. Both output a byte[] that is either compressed or original size.
  • GetDecompressionProgress()
    • Gets the current Decompression Progress of the framework. the return value is a double between 0 and 1. 1 being complete.
  • GetEncodeProgress()
    • Gets the current Encode Progress of the framework. the reurn value is a double between 0 and 1. 1 being complete.
  • GetCaptureCount()
    • Gets the current frame count.
  • GetAcutalFPS()
    • Gets the current actual Frame Capture Rate.

ScapBackendConfig Methods:

  • ScapBackendSetup(ScapCapture Capture)
    • Setup the framework based on a capture that is user defined. This Method must be called for the capture to run.
  • Dispose()
    • Completely destroys all capture data and resets the framework to be used on a different capture. Only call this method if you are sure that the current capture will not be needed as it will no longer exsist once this is called.

Private Methods:

  • SetVideoCodec()
    • Sets up the internal video codec data.
  • SetImageCodec()
    • Sets up the internal Image codec data.
  • ThreadTimer_Tick(object sender, EventArgs e)
    • Control Timer for threading. This does all thread starting and monitoring.
  • Capture/Compress/Write/Decompress/Encode(object s)
    • Internal Thread CallBacks for all data handling done through multithreading.

ScapCapture Methods:

  • ScapCapture(bool RecordMic) + 8 overloads
    • Constructor for Capture data.
  • EnableMultipleDesktop()
    • Not Implemented Yet.
  • Dispose()
    • Destroys this particular capture and removes it from memory. Used only when the capture has been added to the framework.

Last edited Nov 28, 2012 at 12:15 AM by supernomad, version 6


No comments yet.