DirectShow.NETCF

DirectShow.NETCF - Library that allows you to use DirectShow (play multimedia, capture/compress/recompress/preview audio and video) on Windows Mobile 5 or older devices.

Current version: 2.2.0.0

Available:
DirectShowNETCF

ComImports + PInvoke necessary API + some useful classes and methods

DirectShowNETCF.Player

Player class allows you to play audio and video files.
Methods:

  • public bool renderFile(string fileName) - build graph for required file if it possible
  • public bool play() - starts or continues play media file
  • public bool stop() - stops play file
  • public bool pause() - pauses play file
  • public bool setVideoWindow(IntPtr owner) - if it video file then you can set control that video should be rendered on

DirectShowNETCF.Camera

Allows you to preview video from camera, still images (still images and preview in the same time) in future record video.
Methods and Properties:

  • public CaptureType CapType - you can set one of type Preview, Still, PreviewStill
  • public bool init() - builds graph (note: you should set CaptureType, befor init camera)
  • public void release() - destroys graph (free all camera resources)
  • public void stop() - stops graph
  • public bool run(IntPtr owner) - runs graph and starts render captured video on required control
  • public bool run() - runs graph
  • public bool stillImage(string tmpPath) - stills and saves video.
  • public List<string> getMediaTypes() - returns list of supported resolutions
  • public void setMediaType(int index) - changes resolution from current to required
  • public bool resize(IntPtr owner, int width, int height) - call this method if you resized preview control and you want preview to be stretched for new control size
  • public bool flashOn() - turns flash on
  • public bool flashOff() - turns flash off
  • public bool zoomOut() - Zoom -
  • public bool zoomIn() - Zoom +
  • public bool focusMinus() - Focus -
  • public bool focusPlus() - Focus +
  • public bool autoFocusOff() - Turns Off autofocus
  • public bool autoFocusOn() - Turns On autofocus

DirectShowNETCF.Camera.AMCamera

Allows you to preview video from camera and grab raw frames, also allows to receive frames from camera without previewing
Methods and Properties:

  • public bool init(bool nullPreview) - builds graph
  • public void release() - destroys graph (free all camera resources)
  • public void stop() - stops graph
  • public bool run(IntPtr owner) - runs graph and starts render captured video on required control
  • public IntPtr grabFrame(ref long bufSize) - returns raw frame and buffer size, you have to free buffer when you dont need it (call DirectShowNETCF.PInvoke.LocalFree(IntPtr))
  • public bool getGrayScaleImage(IntPtr scan0, int stride) - grabs raw frame and make grayscale image from it. Now works wor rgb565 and YV12 formats.
  • public void getParams(out int width, out int height, out RawFrameFormat format) - returns width, height and format of raw frame
  • public void startDrawText(string text) - draws text on preview
  • stopDrawText() - stops draw text
  • public List<string> getMediaTypes() - returns list of supported resolutions
  • public void setMediaType(int index) - changes resolution from current to required (you have to call init and start again after changing resolution)
  • public bool resize(IntPtr owner, int width, int height) - call this method if you resized preview control and you want preview to be stretched for new control size
  • public bool flashOn() - turns flash on
  • public bool flashOff() - turns flash off
  • public bool zoomOut() - Zoom -
  • public bool zoomIn() - Zoom +
  • public bool focusMinus() - Focus -
  • public bool focusPlus() - Focus +
  • public bool autoFocusOff() - Turns Off autofocus
  • public bool autoFocusOn() - Turns On autofocus
  • public bool drawTarget(Rect rect, int type) - draws target on preview, you can define rect and target type
  • public bool stopDrawTarget() - stops draw target on preview
  • public bool getRgb565(IntPtr scan0) - grabs raw frame and makes rgb565 image from it. Now works wor rgb565 and YV12 formats.

DirectShowNETCF.Camera.AMCameraEx

Allows you to preview video from camera, grab raw RGB24 frames, apply effects for video, draws up to 10 bitmaps on preview
Methods and Properties:

  • public bool init(RotationType rotationType) - builds graph (you can choose type of rotation: None, Auto, Degree90)
  • public void release() - destroys graph (free all camera resources)
  • public void stop() - stops graph
  • public bool run(IntPtr owner) - runs graph and starts render captured video on required control
  • public void fixPreview(bool fix) - fixes preview for Toshiba and LG devices as they have incorrect Chroma buffer ordering
  • public IntPtr grabFrame() - returns raw frame (RGB24, size = 3 * width * height), you have to free buffer when you dont need it (call DirectShowNETCF.PInvoke.LocalFree(IntPtr))
  • public void applyEffect(Effets effect) - applies one of availabel effects (none, grayscale, black and white, sepia, edge detection and cropoval)
  • public void drawBitmap(IntPtr ptr, int id, int x, int y, int width, int height) - draws bitmap on preview
  • public void drawTransparentBitmap(IntPtr ptr, int id, int x, int y, int width, int height, int r, int g, int b) - draws bitmap on preview except pixels that the same with transparent color
  • public void blendBitmap(IntPtr ptr, int id, int x, int y, int width, int height, int blend) - blends preview and required bitmap
  • public void eraseBitmap(int id) - Erases earlier drawn bitmap
  • public void getRect(out int width, out int height) - returns width and height of raw frame
  • public List<string> getMediaTypes() - returns list of supported resolutions
  • public void setMediaType(int index) - changes resolution from current to required (you have to call init and start again after changing resolution)
  • public bool resize(IntPtr owner, int width, int height) - call this method if you resized preview control and you want preview to be stretched for new control size
  • public bool flashOn() - turns flash on
  • public bool flashOff() - turns flash off
  • public bool zoomOut() - Zoom -
  • public bool zoomIn() - Zoom +
  • public bool focusMinus() - Focus -
  • public bool focusPlus() - Focus +
  • public bool autoFocusOff() - Turns Off autofocus
  • public bool autoFocusOn() - Turns On autofocus

NullCamera

Allows to grab frames from camera without preview
Methods:

  • public bool init() - builds grap
  • public void release() - destroys graph
  • public void stop() - stops graph
  • public bool run() - runs graph

Events:

  • EventHandler<FrameEventArgs> GotFrame - fires every time we got new frame from camera.

AMCameraExControl 1.5.0.0

Control that allows you to preview stream from camera, grab bitmaps, draw bitmap on preview, control flash/focus/zoom (if your camera allows it)
Methods and Properties:

  • public bool Start() - starts preview
  • public void Stop() - stops camera
  • public Bitmap GrabFrame() - grabs current frame and returns it as Bitmap
  • public void FixPreview(bool needFix) - fix preview for Toshiba and LG devices
  • public void Overlay(Bitmap bmp, int id, int x, int y) - draws bitmap on preview, x and y - coord of left top corner, id - id that will be used to erase bitmap when you need
  • public void OverlayTransparent(Bitmap bmp, int id, int x, int y, Color transparentColor) - draws bitmap on preview except pixels that equal to transparentColor, x and y - coord of left top corner, id - id that will be used to erase bitmap when you need
  • public void BlendBitmap(Bitmap bmp, int id, int x, int y, byte blend) - blends preview and passed bitmap
  • public void eraseBitmap(int id) - Erases earlier drawn bitmap
  • public Effects Effect - allows you to aplly 1 of supported effects (None, GrayScale, BlackAndWhite, EdgeDetection, CropOval)
  • public bool FlashOn() - turns flash on
  • public bool FlashOff() - turns flash off
  • public bool ZoomOut() - Zoom -
  • public bool ZoomIn() - Zoom +
  • public bool FocusMinus() - Focus -
  • public bool FocusPlus() - Focus +
  • public bool AutoFocusOff() - Turns Off autofocus
  • public bool AutoFocusOn() - Turns On autofocus
  • Allows to handle mouse click (mouse down)

PlayerControl 1.5.0.0

Player class allows you to play audio and video files and mms streams. Also player allow to seek on media, control volume and grab frames.
Properties:

  • public bool Loop - if true then when video ended starts play again
  • public int VideoWidth - real video width
  • public int VideoHeight - real video height
  • public int Volume - you can control player volume (range 0-10000)
  • public int Balance - you can control sound balance
  • public int BitRate - video bitrate if possible to detect

Methods:

  • public void OpenFile(string filePath) - Builds graph that allows to play required file
  • public void Play() - starts or continues play media file
  • public void Stop() - stops play file
  • public void Pause() - pauses play file
  • public void Seek(TimeSpan position) - Sets media to required position
  • public TimeSpan GetDuration() - Gets Duration of media file

Events:

  • public event EventHandler MediaFailed - fiers if its impossible to render file
  • public event EventHandler MediaEnded -fiers when file plaed to the end
  • public event EventHandler<ProgressEventArgs> MediaProgress - fiers every 0,3 seconds and informs about current progress

Download Library and Examples

P.S:

If you need sources of library you can Buy it

233 Responses to “DirectShow.NETCF”

Pages: « 2421 20 19 18 17 [16] 15 14 13 12 111 » Show All

  1. 160
    admin Says:

    2kamil, can you email me some screenshots? also will be great if you will grab some raw frames and email to me, hope it will help to fix this bug, as i dont have omnia 2 to fix it locally

  2. 159
    kamil nowicki Says:

    directshownetcf 1.6.6.0
    i have noticed that this problem only occurs in the last reported resolution on this device (768x-432)
    and the fact that height is being reported as negative for all resolutions is not related to the problem because all other resolutions work fine.
    amcameraex also displays garbage.

    also i have noticed that there is a difference between directshownetcf version 1.6.6.0 vs 1.5.1.0 in reported resolutions:

    1.6.6.0:

    [0] “176X-144″
    [1] “320X-240″
    [2] “144X-176″
    [3] “176X-176″
    [4] “352X-288″
    [5] “720X-480″
    [6] “640X-480″
    [7] “800X-480″
    [8] “800X-450″
    [9] “768X-432″

    1.5.1.0:

    [0] “640X480″
    [1] “1280X960″
    [2] “1600X1200″
    [3] “800X480″
    [4] “2048X1536″
    [5] “2560X1920″
    [6] “1280X768″
    [7] “2048X960″
    [8] “2560X1536″
    [9] “2560X1440″
    [10] “1920X1080″
    [11] “800X450″
    [12] “768X432″

  3. 158
    admin Says:

    What version of library? Whats about AMCameraEx?

  4. 157
    kamil nowicki Says:

    hello,

    i’m having trouble getting directshownetcf to work with samsung i8000 omnia 2.

    getMediaTypes returns resolutions in this format (without quotes):
    “176X-144″
    “768X-432″

    after i click “start” in AMCameraTest i get garbage in the preview area. “show raw frame infp” says:
    width: 176
    height: -144
    format: yv12

    regards

  5. 156
    admin Says:

    version 1.6.6.0 released:

    1) HTC devices preview fixed
    2) AutoFocus fixed

    P.S. tested on Samsung i710, Toshiba Portage G910, HTC Touch2

    P.P.S. Happy New Year :)

  6. 155
    admin Says:

    Ok i bought HTC Touch Diamond2, and seems the best way to work with HTC devices directly with driver. i found HTCCamera.dll and it contain entry points:

    Camera_Begin
    Camera_Deinit
    Camera_End
    Camera_FlashLight
    Camera_GetProperty
    Camera_Init
    Camera_SetProperty

    P.S. to remove message box you can always buy sources :)

  7. 154
    CarlB Says:

    Mery Christmas to all!

    I’ve tried the new version (1.6) but the preview is still “green” ans what I can see it is still flipped (I’ve tested it on an HTC Touch Pro).

    On an HTC HD2 the preview is fine (but extreme slow) and non of the methonds on camera-object does work (autofocusOn, focusMinus, focusPlus, zoomIn, zoomOut, flashOn, flashOff). Perhpas I call it in the wrong moment, but I’ve tried alot… calling autoFocusOn befor init -> Exception, after Init and bevor Run -> nothing happens, after run -> nothing happens -> in a timer bevor grabbin an image -> nothing happens

    On the Touch Pro I can’t test it, because I can not see the result in preview.

    Can you tell us when the Demo-Version-Messagebox came up? If it would came up one time at start, it wouldn’t be a problem, but in my testcase it came up every time i click it away… so I can not realy see whats in the preview ;-)

    thanks alot

  8. 153
    admin Says:

    version 1.6.0.0 released:

    1) Flash and AutoFocus for HTC devices (Untested, but should work)
    2) Some Native bugs fixed

    P.S. Merry Christmas and Happy New Year :)

  9. 152
    admin Says:

    Announcement:
    next build will contain workable flash and autofocus for HTC devices! ;)

  10. 151
    admin Says:

    2Scrappy, class was made to save video/audio streams that streams via MMS protocol, but i did not include it in library, i still thinking if it should be in library at all…

    BTW preview MMS streams you can by PlayerControl

Pages: « 2421 20 19 18 17 [16] 15 14 13 12 111 » Show All

Leave a Reply