Fix a bug in DirectShow when changing webcam resolution and add I420 format support.

cusax-fix
Sebastien Vincent 16 years ago
parent faa3a7ca59
commit 7d41786c85

@ -394,10 +394,7 @@ void DSCaptureDevice::initSupportedFormats()
format.pixelFormat = mediaType->subtype.Data1;
format.mediaType = mediaType->subtype;
if(format.pixelFormat != 0x30323449)
{
m_formats.push_back(format);
}
m_formats.push_back(format);
}
}
}

@ -238,6 +238,7 @@ JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_D
fmt.pixelFormat = (unsigned long)f;
dev->setFormat(fmt);
dev->start();
}
}

@ -3,7 +3,7 @@
#include <windows.h>
#include <dshow.h>
#include <wmcodecdsp.h>
#include <uuids.h>
JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSFormat_getRGB24PixelFormat
(JNIEnv *, jclass)
@ -119,3 +119,9 @@ JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_
return MEDIASUBTYPE_YVYU.Data1;
}
JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSFormat_getI420PixelFormat
(JNIEnv *, jclass)
{
return 0x30323449; //MEDIASUBTYPE_I420.Data1;
}

@ -159,6 +159,14 @@ JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_
JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSFormat_getYVYUPixelFormat
(JNIEnv *, jclass);
/*
* Class: net_java_sip_communicator_impl_neomedia_directshow_DSFormat
* Method: getI420PixelFormat
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSFormat_getI420PixelFormat
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif

@ -26,6 +26,7 @@ public class DSFormat
NV12 = getNV12PixelFormat();
Y411 = getY411PixelFormat();
Y41P = getY41PPixelFormat();
I420 = getI420PixelFormat();
}
/* supported formats */
@ -37,6 +38,7 @@ public class DSFormat
public static final long Y411;
public static final long Y41P;
public static final long NV12;
public static final long I420;
/**
* Video width.
@ -119,5 +121,6 @@ public long getPixelFormat()
public static native long getY41PPixelFormat();
public static native long getYVU9PixelFormat();
public static native long getYVYUPixelFormat();
public static native long getI420PixelFormat();
}

@ -67,6 +67,8 @@ public class DataSource extends AbstractPushBufferCaptureDevice
FFmpeg.PIX_FMT_UYYVYY411,
DSFormat.NV12,
FFmpeg.PIX_FMT_NV12,
DSFormat.I420,
FFmpeg.PIX_FMT_YUV420P,
};
/**
* The default width of <tt>DataSource</tt>.
@ -180,7 +182,7 @@ protected AbstractPushBufferStream createStream(
for(int i = 0 ; i < fmts.length ; i++)
{
System.out.println(fmts[i].getWidth() + " " + fmts[i].getHeight()
+ fmts[i].getColorSpace());
+ " " + fmts[i].getPixelFormat());
}
*/

Loading…
Cancel
Save