diff --git a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
index fab8d6f396f9873475831184a4d29900f9183353..0aa8eb06249cac8a81b860b70b7891a61084f10b 100644
--- a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
+++ b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
@@ -675,20 +675,6 @@ Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1fill
                     (int) width, (int) height);
 }
 
-JNIEXPORT jlong JNICALL
-Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1get_1data0
-    (JNIEnv *env, jclass clazz, jlong picture)
-{
-    return (jlong) (intptr_t) (((AVPicture *) (intptr_t) picture)->data[0]);
-}
-
-JNIEXPORT jint JNICALL
-Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1get_1size
-    (JNIEnv *env, jclass clazz, jint pix_fmt, jint width, jint height)
-{
-    return (jint) avpicture_get_size ((int) pix_fmt, (int) width, (int) height);
-}
-
 JNIEXPORT jlong JNICALL
 Java_org_jitsi_impl_neomedia_codec_FFmpeg_get_1filtered_1video_1frame
     (JNIEnv *env, jclass clazz,
diff --git a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.h b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.h
index a44b028897b4a0653cd19d4c8868494adf03a73d..bb9c8f33b45f63ba3afd7065a4b8b359906b2e8a 100644
--- a/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.h
+++ b/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.h
@@ -527,22 +527,6 @@ JNIEXPORT void JNICALL Java_org_jitsi_impl_neomedia_codec_FFmpeg_avframe_1set_1l
 JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1fill
   (JNIEnv *, jclass, jlong, jlong, jint, jint, jint);
 
-/*
- * Class:     org_jitsi_impl_neomedia_codec_FFmpeg
- * Method:    avpicture_get_data0
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1get_1data0
-  (JNIEnv *, jclass, jlong);
-
-/*
- * Class:     org_jitsi_impl_neomedia_codec_FFmpeg
- * Method:    avpicture_get_size
- * Signature: (III)I
- */
-JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_codec_FFmpeg_avpicture_1get_1size
-  (JNIEnv *, jclass, jint, jint, jint);
-
 /*
  * Class:     org_jitsi_impl_neomedia_codec_FFmpeg
  * Method:    get_filtered_video_frame
diff --git a/src/org/jitsi/impl/neomedia/codec/FFmpeg.java b/src/org/jitsi/impl/neomedia/codec/FFmpeg.java
index f1f01c7d8d9c8ab09d2666f96c84e302d5fbc85a..6a0e8f5f0377da7090f7cee89b9c697d04ed28ea 100644
--- a/src/org/jitsi/impl/neomedia/codec/FFmpeg.java
+++ b/src/org/jitsi/impl/neomedia/codec/FFmpeg.java
@@ -19,6 +19,8 @@ public class FFmpeg
      */
     public static final long AV_NOPTS_VALUE = 0x8000000000000000L;
 
+    public static final int AV_NUM_DATA_POINTERS = 8;
+
     /**
      * The AV sample format for signed 16.
      */
@@ -179,6 +181,9 @@ public class FFmpeg
      */
     public static final int PIX_FMT_UYYVYY411 = 18;
 
+    /** Y41P format */
+    public static final int PIX_FMT_YUV411P = 7;
+
     /**
      * YUV420P format.
      */
@@ -684,23 +689,21 @@ public static native int avfilter_graph_parse(
 
     public static native long avframe_get_pts(long frame);
 
-    public static native void avframe_set_data(long frame, long data0,
-        long offset1, long offset2);
+    public static native void avframe_set_data(
+            long frame,
+            long data0, long offset1, long offset2);
 
-    public static native void avframe_set_key_frame(long frame,
-        boolean key_frame);
+    public static native void avframe_set_key_frame(
+            long frame,
+            boolean key_frame);
 
-    public static native void avframe_set_linesize(long frame, int linesize0,
-        int linesize1, int linesize2);
+    public static native void avframe_set_linesize(
+            long frame,
+            int linesize0, int linesize1, int linesize2);
 
     public static native int avpicture_fill(long picture, long ptr,
         int pix_fmt, int width, int height);
 
-    public static native long avpicture_get_data0(long picture);
-
-    public static native int avpicture_get_size(int pix_fmt, int width,
-        int height);
-
     public static native long get_filtered_video_frame(
             long input, int width, int height, int pixFmt,
             long buffer,
diff --git a/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java b/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java
index 91d98033b8a03c489c78a0b2c5ebf1f02d4bb97f..3df0d66271aabc349108bd700a3b7ae753b53905 100644
--- a/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java
+++ b/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java
@@ -25,23 +25,23 @@ public class AVFrameFormat
     extends VideoFormat
 {
     /**
-     * Serial version UID.
+     * The encoding of the <tt>AVFrameFormat</tt> instances.
      */
-    private static final long serialVersionUID = 0L;
+    public static final String AVFRAME = "AVFrame";
 
     /**
-     * The encoding of the <tt>AVFrameFormat</tt> instances.
+     * Serial version UID.
      */
-    public static final String AVFRAME = "AVFrame";
+    private static final long serialVersionUID = 0L;
 
     /**
-     * The native device-specific format represented by this instance. It's
-     * necessary in the cases of multiple device-specific formats corresponding
-     * to one and the same native FFmpeg format in which JMF is unable to
-     * differentiate them, yet the device needs to know its device-specific
-     * format.
+     * The <tt>DeviceSystem</tt>-specific format represented by this instance.
+     * It is necessary in the cases of multiple <tt>DeviceSystem</tt>-specific
+     * formats corresponding to one and the same native FFmpeg format in which
+     * JMF is unable to differentiate them yet the device needs to know its
+     * <tt>DeviceSystem</tt>-specific format.
      */
-    private int devicePixFmt;
+    private int deviceSystemPixFmt;
 
     /**
      * The native FFmpeg format represented by this instance.
@@ -57,15 +57,30 @@ public AVFrameFormat()
         this(NOT_SPECIFIED, NOT_SPECIFIED);
     }
 
+    public AVFrameFormat(Dimension size, float frameRate, int pixFmt)
+    {
+        this(size, frameRate, pixFmt, NOT_SPECIFIED);
+    }
+
     /**
-     * Initializes a new <tt>AVFrameFormat</tt> instance with a specific FFmpeg
-     * colorspace and unspecified size and frame rate.
+     * Initializes a new <tt>AVFrameFormat</tt> instance with specific size,
+     * frame rate and FFmpeg colorspace.
      *
+     * @param size the <tt>Dimension</tt> of the new instance
+     * @param frameRate the frame rate of the new instance
      * @param pixFmt the FFmpeg colorspace to be represented by the new instance
+     * @param deviceSystemPixFmt the <tt>DeviceSystem</tt>-specific colorspace
+     * to be represented by the new instance
      */
-    public AVFrameFormat(int pixFmt)
+    public AVFrameFormat(
+            Dimension size,
+            float frameRate,
+            int pixFmt, int deviceSystemPixFmt)
     {
-        this(pixFmt, NOT_SPECIFIED);
+        super(AVFRAME, size, NOT_SPECIFIED, AVFrame.class, frameRate);
+
+        this.pixFmt = pixFmt;
+        this.deviceSystemPixFmt = deviceSystemPixFmt;
     }
 
     /**
@@ -73,33 +88,23 @@ public AVFrameFormat(int pixFmt)
      * colorspace and unspecified size and frame rate.
      *
      * @param pixFmt the FFmpeg colorspace to be represented by the new instance
-     * @param devicePixFmt the capture device colorspace to be represented by
-     * the new instance
      */
-    public AVFrameFormat(int pixFmt, int devicePixFmt)
+    public AVFrameFormat(int pixFmt)
     {
-        this(null, NOT_SPECIFIED, pixFmt, devicePixFmt);
+        this(pixFmt, NOT_SPECIFIED);
     }
 
     /**
-     * Initializes a new <tt>AVFrameFormat</tt> instance with specific size,
-     * frame rate and FFmpeg colorspace.
+     * Initializes a new <tt>AVFrameFormat</tt> instance with a specific FFmpeg
+     * colorspace and unspecified size and frame rate.
      *
-     * @param size the <tt>Dimension</tt> of the new instance
-     * @param frameRate the frame rate of the new instance
      * @param pixFmt the FFmpeg colorspace to be represented by the new instance
-     * @param devicePixFmt the capture device colorspace to be represented by
-     * the new instance
+     * @param deviceSystemPixFmt the <tt>DeviceSystem</tt>-specific colorspace
+     * to be represented by the new instance
      */
-    public AVFrameFormat(
-            Dimension size,
-            float frameRate,
-            int pixFmt, int devicePixFmt)
+    public AVFrameFormat(int pixFmt, int deviceSystemPixFmt)
     {
-        super(AVFRAME, size, NOT_SPECIFIED, AVFrame.class, frameRate);
-
-        this.pixFmt = pixFmt;
-        this.devicePixFmt = devicePixFmt;
+        this(null, NOT_SPECIFIED, pixFmt, deviceSystemPixFmt);
     }
 
     /**
@@ -116,7 +121,7 @@ public Object clone()
             = new AVFrameFormat(
                     getSize(),
                     getFrameRate(),
-                    pixFmt, devicePixFmt);
+                    pixFmt, deviceSystemPixFmt);
 
         f.copy(this);
         return f;
@@ -139,7 +144,7 @@ protected void copy(Format f)
             AVFrameFormat avFrameFormat = (AVFrameFormat) f;
 
             pixFmt = avFrameFormat.pixFmt;
-            devicePixFmt = avFrameFormat.devicePixFmt;
+            deviceSystemPixFmt = avFrameFormat.deviceSystemPixFmt;
         }
     }
 
@@ -167,23 +172,25 @@ public boolean equals(Object obj)
     }
 
     /**
-     * Gets the native FFmpeg format represented by this instance.
+     * Gets the <tt>DeviceSystem</tt>-specific format represented by this
+     * instance.
      *
-     * @return the native FFmpeg format represented by this instance
+     * @return the <tt>DeviceSystem</tt>-specific format represented by this
+     * instance
      */
-    public int getPixFmt()
+    public int getDeviceSystemPixFmt()
     {
-        return pixFmt;
+        return deviceSystemPixFmt;
     }
 
     /**
-     * Gets the native capture device format represented by this instance.
+     * Gets the native FFmpeg format represented by this instance.
      *
-     * @return native capture device format represented by this instance
+     * @return the native FFmpeg format represented by this instance
      */
-    public int getDevicePixFmt()
+    public int getPixFmt()
     {
-        return devicePixFmt;
+        return pixFmt;
     }
 
     @Override
diff --git a/src/org/jitsi/impl/neomedia/codec/video/SwScaler.java b/src/org/jitsi/impl/neomedia/codec/video/SwScaler.java
index a3839a75dc8fb127b5d2d2eb4572d458f0535a3b..000078b5f3b372b02801d3da21eb38da0e2ad1ae 100644
--- a/src/org/jitsi/impl/neomedia/codec/video/SwScaler.java
+++ b/src/org/jitsi/impl/neomedia/codec/video/SwScaler.java
@@ -73,7 +73,7 @@ public class SwScaler
     };
 
     /**
-     * Libswscale context pointer.
+     * The pointer to the <tt>libswscale</tt> context.
      */
     private long swsContext = 0;
 
@@ -166,6 +166,7 @@ public static int getNativeRGBFormat(RGBFormat rgb)
         int fmt;
 
         if(rgb.getBitsPerPixel() == 32)
+        {
             switch(rgb.getRedMask())
             {
             case 1:
@@ -189,6 +190,7 @@ public static int getNativeRGBFormat(RGBFormat rgb)
                 fmt = FFmpeg.PIX_FMT_RGB32;
                 break;
             }
+        }
         else
             fmt = FFmpeg.PIX_FMT_RGB24;
 
@@ -470,13 +472,10 @@ public Format setInputFormat(Format format)
         Format inputFormat
             = (format instanceof VideoFormat)
                 ? super.setInputFormat(format)
-                : null /* A size is not required, the input must be video. */;
+                : null /* The input must be video, a size is not required. */;
 
-        if (inputFormat != null)
-        {
-            if (logger.isDebugEnabled())
-                logger.debug("SwScaler set to input in " + inputFormat);
-        }
+        if ((inputFormat != null) && logger.isDebugEnabled())
+            logger.debug("SwScaler set to input in " + inputFormat);
         return inputFormat;
     }
 
diff --git a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DataSource.java b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DataSource.java
index 4febffffeb0c6c92d00b0c6f5e15d1971d4fe8de..3ce61c665f61678e3e8ba0be528fabb3199e4d8b 100644
--- a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DataSource.java
+++ b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DataSource.java
@@ -35,33 +35,10 @@ public class DataSource
     extends AbstractVideoPushBufferCaptureDevice
 {
     /**
-     * The <tt>Logger</tt> used by the <tt>DataSource</tt> class and its
-     * instances for logging output.
-     */
-    private static final Logger logger = Logger.getLogger(DataSource.class);
-
-    /**
-     * DirectShow capture device.
-     */
-    private DSCaptureDevice device = null;
-
-    /**
-     * Delegate grabber. Each frame captured by device will be pass through this
-     * grabber.
-     */
-    private DSCaptureDevice.GrabberDelegate grabber = null;
-
-
-    /**
-     * DirectShow manager.
-     */
-    private DSManager manager = null;
-
-    /**
-     * The map of DirectShow pixel formats to FFmpeg
-     * pixel formats which allows converting between the two.
+     * The map of DirectShow pixel formats to FFmpeg pixel formats which allows
+     * converting between the two.
      */
-    private static final long[] DS_TO_FFMPEG_PIX_FMT
+    private static final long[] DS_TO_FFMPEG_PIX_FMTS
         = new long[]
                 {
                     DSFormat.RGB24,
@@ -77,104 +54,90 @@ public class DataSource
                     DSFormat.Y411,
                     FFmpeg.PIX_FMT_UYYVYY411,
                     DSFormat.Y41P,
-                    FFmpeg.PIX_FMT_UYYVYY411,
+                    FFmpeg.PIX_FMT_YUV411P,
                     DSFormat.NV12,
                     FFmpeg.PIX_FMT_NV12,
                     DSFormat.I420,
-                    FFmpeg.PIX_FMT_YUV420P,
+                    FFmpeg.PIX_FMT_YUV420P
                 };
 
     /**
-     * Last known native DirectShow format.
+     * The <tt>Logger</tt> used by the <tt>DataSource</tt> class and its
+     * instances for logging output.
      */
-    private DSFormat nativeFormat = null;
+    private static final Logger logger = Logger.getLogger(DataSource.class);
 
     /**
-     * Constructor.
+     * Gets the FFmpeg pixel format matching a specific DirectShow
+     * Specification pixel format.
+     *
+     * @param ffmpegPixFmt FFmpeg format
+     * @return the DirectShow pixel format matching the specified FFmpeg format
      */
-    public DataSource()
+    public static long getDSPixFmt(int ffmpegPixFmt)
     {
-        manager = DSManager.getInstance();
+        for (int i = 0; i < DS_TO_FFMPEG_PIX_FMTS.length; i += 2)
+            if (DS_TO_FFMPEG_PIX_FMTS[i + 1] == ffmpegPixFmt)
+                return DS_TO_FFMPEG_PIX_FMTS[i];
+        return -1;
     }
 
     /**
-     * Initializes a new <tt>DataSource</tt> instance from a specific
-     * <tt>MediaLocator</tt>.
+     * Gets the DirectShow pixel format matching a specific FFmpeg pixel
+     * format.
      *
-     * @param locator the <tt>MediaLocator</tt> to create the new instance from
+     * @param dsPixFmt the DirectShow pixel format to get the matching
+     * FFmpeg pixel format of
+     * @return the FFmpeg pixel format matching the specified DirectShow pixel
      */
-    public DataSource(MediaLocator locator)
+    public static long getFFmpegPixFmt(long dsPixFmt)
     {
-        super(locator);
-        manager = DSManager.getInstance();
+        for (int i = 0; i < DS_TO_FFMPEG_PIX_FMTS.length; i += 2)
+            if (DS_TO_FFMPEG_PIX_FMTS[i] == dsPixFmt)
+                return DS_TO_FFMPEG_PIX_FMTS[i + 1];
+        return FFmpeg.PIX_FMT_NONE;
     }
 
     /**
-     * Sets the <tt>MediaLocator</tt> which specifies the media source of this
-     * <tt>DataSource</tt>.
-     *
-     * @param locator the <tt>MediaLocator</tt> which specifies the media source
-     * of this <tt>DataSource</tt>
-     * @see DataSource#setLocator(MediaLocator)
+     * DirectShow capture device.
      */
-    @Override
-    public void setLocator(MediaLocator locator)
-    {
-        DSCaptureDevice device = null;
-        logger.info("set locator to " + locator);
-
-        if(getLocator() == null)
-            super.setLocator(locator);
-        locator = getLocator();
-        logger.info("getLocator() returns " + locator);
+    private DSCaptureDevice device = null;
 
-        if((locator != null) &&
-                DeviceSystem.LOCATOR_PROTOCOL_DIRECTSHOW.equalsIgnoreCase(
-                        locator.getProtocol()))
-        {
-            DSCaptureDevice[] devices = manager.getCaptureDevices();
+    /**
+     * Delegate grabber. Each frame captured by device will be pass through this
+     * grabber.
+     */
+    private DSCaptureDevice.GrabberDelegate grabber = null;
 
-            logger.info("Search directshow device...");
+    /**
+     * DirectShow manager.
+     */
+    private DSManager manager = null;
 
-            /* find device */
-            for(int i = 0 ; i < devices.length ; i++)
-            {
-                if(devices[i].getName().equals(locator.getRemainder()))
-                {
-                    device = devices[i];
-                    logger.info("Set directshow device: " + device);
-                    break;
-                }
-            }
+    /**
+     * Last known native DirectShow format.
+     */
+    private DSFormat nativeFormat = null;
 
-            if(device == null)
-            {
-                logger.info("No devices matches locator's remainder: " +
-                        locator.getRemainder());
-            }
-        }
-        else
-        {
-            logger.info(
-                    "MediaLocator either null or does not have right protocol");
-            device = null;
-        }
-        setDevice(device);
+    /**
+     * Constructor.
+     */
+    public DataSource()
+    {
+        manager = DSManager.getInstance();
     }
 
     /**
-     * Sets the <tt>DSCaptureDevice</tt> which represents the media source of
-     * this <tt>DataSource</tt>.
+     * Initializes a new <tt>DataSource</tt> instance from a specific
+     * <tt>MediaLocator</tt>.
      *
-     * @param device the <tt>DSCaptureDevice</tt> which represents the media
-     * source of this <tt>DataSource</tt>
+     * @param locator the <tt>MediaLocator</tt> to create the new instance from
      */
-    private void setDevice(DSCaptureDevice device)
+    public DataSource(MediaLocator locator)
     {
-        if(this.device != device)
-        {
-            this.device = device;
-        }
+        super(locator);
+
+        manager = DSManager.getInstance();
     }
 
     /**
@@ -255,6 +218,95 @@ protected AbstractPushBufferStream createStream(
         return stream;
     }
 
+    /**
+     * Opens a connection to the media source specified by the
+     * <tt>MediaLocator</tt> of this <tt>DataSource</tt>.
+     *
+     * @throws IOException if anything goes wrong while opening the connection
+     * to the media source specified by the <tt>MediaLocator</tt> of this
+     * <tt>DataSource</tt>
+     * @see AbstractPushBufferCaptureDevice#doConnect()
+     */
+    @Override
+    protected void doConnect() throws IOException
+    {
+        if (logger.isInfoEnabled())
+            logger.info("doConnect");
+
+        if(manager == null)
+            manager = DSManager.getInstance();
+
+        setLocator(getLocator());
+
+        super.doConnect();
+    }
+
+    /**
+     * Closes the connection to the media source specified by the
+     * <tt>MediaLocator</tt> of this <tt>DataSource</tt>.
+     *
+     * @see AbstractPushBufferCaptureDevice#doDisconnect()
+     */
+    @Override
+    protected void doDisconnect()
+    {
+        if (logger.isInfoEnabled())
+            logger.info("doDisconnect");
+
+        super.doDisconnect();
+
+        if(manager != null)
+        {
+            device.setDelegate(null);
+            device = null;
+
+            DSManager.dispose();
+            manager = null;
+        }
+    }
+
+    /**
+     * Starts the transfer of media data from this <tt>DataSource</tt>.
+     *
+     * @throws IOException if anything goes wrong while starting the transfer of
+     * media data from this <tt>DataSource</tt>
+     * @see AbstractPushBufferCaptureDevice#doStart()
+     */
+    @Override
+    protected void doStart() throws IOException
+    {
+        if (logger.isInfoEnabled())
+            logger.info("start");
+
+        /* Open and start the capture. */
+        device.open();
+        if(nativeFormat != null)
+            device.setFormat(nativeFormat);
+
+        device.setDelegate(grabber);
+
+        super.doStart();
+    }
+
+    /**
+     * Stops the transfer of media data from this <tt>DataSource</tt>.
+     *
+     * @throws IOException if anything goes wrong while stopping the transfer of
+     * media data from this <tt>DataSource</tt>
+     * @see AbstractPushBufferCaptureDevice#doStop()
+     */
+    @Override
+    protected void doStop() throws IOException
+    {
+        if (logger.isInfoEnabled())
+            logger.info("stop");
+
+        super.doStop();
+
+        /* Stop and close the capture. */
+        device.close();
+    }
+
     /**
      * Gets the <tt>Format</tt>s which are to be reported by a
      * <tt>FormatControl</tt> as supported formats for a
@@ -295,6 +347,18 @@ protected Format[] getSupportedFormats(int streamIndex)
         return fmts.toArray(new Format[fmts.size()]);
     }
 
+    /**
+     * Sets the <tt>DSCaptureDevice</tt> which represents the media source of
+     * this <tt>DataSource</tt>.
+     *
+     * @param device the <tt>DSCaptureDevice</tt> which represents the media
+     * source of this <tt>DataSource</tt>
+     */
+    private void setDevice(DSCaptureDevice device)
+    {
+        this.device = device;
+    }
+
     /**
      * Attempts to set the <tt>Format</tt> to be reported by the
      * <tt>FormatControl</tt> of a <tt>PushBufferStream</tt> at a specific
@@ -323,26 +387,23 @@ protected Format setFormat(
         {
             if(newValue instanceof AVFrameFormat)
             {
-                AVFrameFormat newAVFrameFormatValue
-                    = (AVFrameFormat) newValue;
-                long pixelFormat = newAVFrameFormatValue.getDevicePixFmt();
+                AVFrameFormat avFrameFormat = (AVFrameFormat) newValue;
+                long pixFmt = getDSPixFmt(avFrameFormat.getPixFmt());
 
-                if(pixelFormat != -1)
+                if(pixFmt != -1)
                 {
-                    Dimension size = newAVFrameFormatValue.getSize();
+                    Dimension size = avFrameFormat.getSize();
 
                     /*
                      * We will set the native format in doStart() because a
-                     * connect-disconnect-connect sequence of the native
-                     * capture device may reorder its formats in a different
-                     * way. Consequently, in the absence of further calls to
+                     * connect-disconnect-connect sequence of the native capture
+                     * device may reorder its formats in a different way.
+                     * Consequently, in the absence of further calls to
                      * setFormat() by JMF, a crash may occur later (typically,
                      * during scaling) because of a wrong format.
                      */
                     nativeFormat
-                        = new DSFormat(
-                                size.width, size.height,
-                                pixelFormat);
+                        = new DSFormat(size.width, size.height, pixFmt);
                 }
             }
 
@@ -354,121 +415,55 @@ protected Format setFormat(
     }
 
     /**
-     * Opens a connection to the media source specified by the
-     * <tt>MediaLocator</tt> of this <tt>DataSource</tt>.
+     * Sets the <tt>MediaLocator</tt> which specifies the media source of this
+     * <tt>DataSource</tt>.
      *
-     * @throws IOException if anything goes wrong while opening the connection
-     * to the media source specified by the <tt>MediaLocator</tt> of this
-     * <tt>DataSource</tt>
-     * @see AbstractPushBufferCaptureDevice#doConnect()
+     * @param locator the <tt>MediaLocator</tt> which specifies the media source
+     * of this <tt>DataSource</tt>
+     * @see DataSource#setLocator(MediaLocator)
      */
     @Override
-    protected void doConnect() throws IOException
+    public void setLocator(MediaLocator locator)
     {
-        if (logger.isInfoEnabled())
-            logger.info("doConnect");
-
-        if(manager == null)
-            manager = DSManager.getInstance();
+        DSCaptureDevice device = null;
+        logger.info("set locator to " + locator);
 
-        setLocator(getLocator());
+        if(getLocator() == null)
+            super.setLocator(locator);
+        locator = getLocator();
+        logger.info("getLocator() returns " + locator);
 
-        super.doConnect();
-    }
+        if((locator != null) &&
+                DeviceSystem.LOCATOR_PROTOCOL_DIRECTSHOW.equalsIgnoreCase(
+                        locator.getProtocol()))
+        {
+            DSCaptureDevice[] devices = manager.getCaptureDevices();
 
-    /**
-     * Closes the connection to the media source specified by the
-     * <tt>MediaLocator</tt> of this <tt>DataSource</tt>.
-     *
-     * @see AbstractPushBufferCaptureDevice#doDisconnect()
-     */
-    @Override
-    protected void doDisconnect()
-    {
-        if (logger.isInfoEnabled())
-            logger.info("doDisconnect");
+            logger.info("Search directshow device...");
 
-        super.doDisconnect();
+            /* find device */
+            for(int i = 0 ; i < devices.length ; i++)
+            {
+                if(devices[i].getName().equals(locator.getRemainder()))
+                {
+                    device = devices[i];
+                    logger.info("Set directshow device: " + device);
+                    break;
+                }
+            }
 
-        if(manager != null)
+            if(device == null)
+            {
+                logger.info("No devices matches locator's remainder: " +
+                        locator.getRemainder());
+            }
+        }
+        else
         {
-            device.setDelegate(null);
+            logger.info(
+                    "MediaLocator either null or does not have right protocol");
             device = null;
-
-            DSManager.dispose();
-            manager = null;
         }
-    }
-
-    /**
-     * Starts the transfer of media data from this <tt>DataSource</tt>.
-     *
-     * @throws IOException if anything goes wrong while starting the transfer of
-     * media data from this <tt>DataSource</tt>
-     * @see AbstractPushBufferCaptureDevice#doStart()
-     */
-    @Override
-    protected void doStart() throws IOException
-    {
-        if (logger.isInfoEnabled())
-            logger.info("start");
-
-        /* open and start capture */
-        device.open();
-        if(nativeFormat != null)
-            device.setFormat(nativeFormat);
-
-        device.setDelegate(grabber);
-
-        super.doStart();
-    }
-
-    /**
-     * Stops the transfer of media data from this <tt>DataSource</tt>.
-     *
-     * @throws IOException if anything goes wrong while stopping the transfer of
-     * media data from this <tt>DataSource</tt>
-     * @see AbstractPushBufferCaptureDevice#doStop()
-     */
-    @Override
-    protected void doStop() throws IOException
-    {
-        if (logger.isInfoEnabled())
-            logger.info("stop");
-
-        /* close capture */
-        super.doStop();
-        device.close();
-    }
-
-    /**
-     * Gets the DirectShow pixel format matching a specific FFmpeg pixel
-     * format.
-     *
-     * @param dsPixFmt the DirectShow pixel format to get the matching
-     * FFmpeg pixel format of
-     * @return the FFmpeg pixel format matching the specified DirectShow pixel
-     */
-    public static long getFFmpegPixFmt(long dsPixFmt)
-    {
-        for (int i = 0; i < DS_TO_FFMPEG_PIX_FMT.length; i += 2)
-            if (DS_TO_FFMPEG_PIX_FMT[i] == dsPixFmt)
-                return DS_TO_FFMPEG_PIX_FMT[i + 1];
-        return FFmpeg.PIX_FMT_NONE;
-    }
-
-    /**
-     * Gets the FFmpeg pixel format matching a specific DirectShow
-     * Specification pixel format.
-     *
-     * @param ffmpegPixFmt FFmpeg format
-     * @return the DirectShow pixel format matching the specified FFmpeg format
-     */
-    public static long getDSPixFmt(int ffmpegPixFmt)
-    {
-        for (int i = 0; i < DS_TO_FFMPEG_PIX_FMT.length; i += 2)
-            if (DS_TO_FFMPEG_PIX_FMT[i + 1] == ffmpegPixFmt)
-                return DS_TO_FFMPEG_PIX_FMT[i];
-        return -1;
+        setDevice(device);
     }
 }
diff --git a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/quicktime/QuickTimeStream.java b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/quicktime/QuickTimeStream.java
index 2c4cc99b6143fb27b49b433b68d7dca4535469bf..58fc2f268d7ba1a3c5ca4229c55cad0a4219a414 100644
--- a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/quicktime/QuickTimeStream.java
+++ b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/quicktime/QuickTimeStream.java
@@ -666,14 +666,18 @@ private void setCaptureOutputFormat(Format format)
 
         if (format instanceof AVFrameFormat)
         {
-            int pixFmt = ((AVFrameFormat) format).getPixFmt();
-
-            if (pixFmt == FFmpeg.PIX_FMT_YUV420P)
-                encoding = VideoFormat.YUV;
-            else if (pixFmt == FFmpeg.PIX_FMT_ARGB)
+            switch (((AVFrameFormat) format).getPixFmt())
+            {
+            case FFmpeg.PIX_FMT_ARGB:
                 encoding = VideoFormat.RGB;
-            else
+                break;
+            case FFmpeg.PIX_FMT_YUV420P:
+                encoding = VideoFormat.YUV;
+                break;
+            default:
                 encoding = null;
+                break;
+            }
         }
         else if (format.isSameEncoding(VideoFormat.RGB))
             encoding = VideoFormat.RGB;
diff --git a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/video4linux2/Video4Linux2Stream.java b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/video4linux2/Video4Linux2Stream.java
index ced141bccdc242bce405ee91b23a7dc981366f27..5c0c1a0eb9e98cde87eeeebe8f974cdf7a559d29 100644
--- a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/video4linux2/Video4Linux2Stream.java
+++ b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/video4linux2/Video4Linux2Stream.java
@@ -629,7 +629,7 @@ private void setFdFormat(Format format)
 
         if (format instanceof AVFrameFormat)
         {
-            pixelformat = ((AVFrameFormat) format).getDevicePixFmt();
+            pixelformat = ((AVFrameFormat) format).getDeviceSystemPixFmt();
             nativePixelFormat = pixelformat;
         }
         if (Video4Linux2.V4L2_PIX_FMT_NONE == pixelformat)