diff --git a/lib/native/windows-64/jndirectshow.dll b/lib/native/windows-64/jndirectshow.dll index 3e5e5faa38e46728db0df559cbcb28edb0a4d840..62196761ea993ff04266dce80718fcd36a45e7f4 100644 Binary files a/lib/native/windows-64/jndirectshow.dll and b/lib/native/windows-64/jndirectshow.dll differ diff --git a/lib/native/windows/jndirectshow.dll b/lib/native/windows/jndirectshow.dll index 594fcdb4dc4b0e0e438b45e3f634daddbc4e631f..6f85a4113244ac4a8f2bf22ecab5a38e14955eba 100644 Binary files a/lib/native/windows/jndirectshow.dll and b/lib/native/windows/jndirectshow.dll differ diff --git a/src/native/windows/directshow/DSFormat.h b/src/native/windows/directshow/DSFormat.h index cfa9c332f4c6aa792a22a2984f708a2ac1b594ba..5c75c118e2f321811a324da64841bad441961c9d 100644 --- a/src/native/windows/directshow/DSFormat.h +++ b/src/native/windows/directshow/DSFormat.h @@ -22,7 +22,7 @@ struct DSFormat { size_t width; /**< Video width */ size_t height; /**< Video height */ - unsigned long pixelFormat; /**< Pixel format */ + DWORD pixelFormat; /**< Pixel format */ GUID mediaType; /**< Media type */ }; diff --git a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp index bd81623260bf5281fec2be69755874b533d0390e..5f0c25816b6ef32cc25205e9ad9858d762c9c0c7 100644 --- a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp +++ b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp @@ -210,21 +210,24 @@ JNIEXPORT jobject JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_dir DSFormat fmt = dev->getFormat(); jclass clazzDSFormat = NULL; jmethodID initDSFormat = NULL; - jobject ret = NULL; /* get DSFormat class to instantiate some object */ clazzDSFormat = env->FindClass("org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat"); if(clazzDSFormat == NULL) return NULL; - initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(IIJ)V"); + initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(III)V"); if(initDSFormat == NULL) return NULL; - ret = env->NewObject(clazzDSFormat, initDSFormat, static_cast<size_t>(fmt.width), - static_cast<size_t>(fmt.height), static_cast<jlong>(fmt.pixelFormat)); - return ret; + return + env->NewObject( + clazzDSFormat, + initDSFormat, + static_cast<jint>(fmt.width), + static_cast<jint>(fmt.height), + static_cast<jint>(fmt.pixelFormat)); } /** @@ -273,7 +276,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protoco if(clazzDSFormat == NULL) return NULL; - initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(IIJ)V"); + initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(III)V"); if(initDSFormat == NULL) return NULL; @@ -284,8 +287,13 @@ JNIEXPORT jobjectArray JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protoco for(std::list<DSFormat>::iterator it = formats.begin() ; it != formats.end() ; ++it) { DSFormat tmp = (*it); - jobject o = env->NewObject(clazzDSFormat, initDSFormat, static_cast<size_t>(tmp.width), - static_cast<size_t>(tmp.height), static_cast<jlong>(tmp.pixelFormat)); + jobject o + = env->NewObject( + clazzDSFormat, + initDSFormat, + static_cast<jint>(tmp.width), + static_cast<jint>(tmp.height), + static_cast<jint>(tmp.pixelFormat)); if(o == NULL) { @@ -370,7 +378,7 @@ Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_se if (widthFieldID) { jfieldID pixelFormatFieldID - = env->GetFieldID(clazz, "pixelFormat", "J"); + = env->GetFieldID(clazz, "pixelFormat", "I"); if (pixelFormatFieldID) { @@ -378,7 +386,7 @@ Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_se format_.height = env->GetIntField(format, heightFieldID); format_.pixelFormat - = (unsigned long) + = (DWORD) (env->GetLongField(format, pixelFormatFieldID)); format_.width = env->GetIntField(format, widthFieldID); diff --git a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.cpp b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.cpp index 613f39455b388b6b66167500bcf7b66dee0ca4e8..e091012ef034e39630e23bd5629c48297be74fdc 100644 --- a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.cpp +++ b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.cpp @@ -11,122 +11,31 @@ #include <dshow.h> #include <uuids.h> -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getRGB24PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_RGB24.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getRGB32PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_RGB32.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getARGBPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_ARGB32.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getAYUVPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_AYUV.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYUY2PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_YUY2.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getUYVYPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_UYVY.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC1PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IMC1.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC2PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IMC2.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC3PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IMC3.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC4PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IMC4.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYV12PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_YV12.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getNV12PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_NV12.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIF09PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IF09.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIYUVPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_IYUV.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY211PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_Y211.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY411PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_Y411.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY41PPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_Y41P.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYVU9PixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_YVU9.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYVYUPixelFormat - (JNIEnv *, jclass) -{ - return MEDIASUBTYPE_YVYU.Data1; -} - -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getI420PixelFormat - (JNIEnv *, jclass) -{ - return 0x30323449; //MEDIASUBTYPE_I420.Data1; -} +#define DEFINE_DSFORMAT_PIXELFORMAT(pixFmt) \ + JNIEXPORT jint JNICALL \ + Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_##pixFmt \ + (JNIEnv *env, jclass clazz) \ + { \ + return MEDIASUBTYPE_##pixFmt.Data1; \ + } + +DEFINE_DSFORMAT_PIXELFORMAT(ARGB32) +DEFINE_DSFORMAT_PIXELFORMAT(AYUV) +DEFINE_DSFORMAT_PIXELFORMAT(I420) +DEFINE_DSFORMAT_PIXELFORMAT(IF09) +DEFINE_DSFORMAT_PIXELFORMAT(IMC1) +DEFINE_DSFORMAT_PIXELFORMAT(IMC2) +DEFINE_DSFORMAT_PIXELFORMAT(IMC3) +DEFINE_DSFORMAT_PIXELFORMAT(IMC4) +DEFINE_DSFORMAT_PIXELFORMAT(IYUV) +DEFINE_DSFORMAT_PIXELFORMAT(NV12) +DEFINE_DSFORMAT_PIXELFORMAT(RGB24) +DEFINE_DSFORMAT_PIXELFORMAT(RGB32) +DEFINE_DSFORMAT_PIXELFORMAT(UYVY) +DEFINE_DSFORMAT_PIXELFORMAT(Y211) +DEFINE_DSFORMAT_PIXELFORMAT(Y411) +DEFINE_DSFORMAT_PIXELFORMAT(Y41P) +DEFINE_DSFORMAT_PIXELFORMAT(YUY2) +DEFINE_DSFORMAT_PIXELFORMAT(YV12) +DEFINE_DSFORMAT_PIXELFORMAT(YVU9) +DEFINE_DSFORMAT_PIXELFORMAT(YVYU) diff --git a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.h b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.h index a29c5ba06e11576478146a64dddc48e3a85a4eb6..b739f508863dc5d1fb6e17fb6a1f5152857fb756 100644 --- a/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.h +++ b/src/native/windows/directshow/org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat.h @@ -9,162 +9,162 @@ extern "C" { #endif /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getARGBPixelFormat - * Signature: ()J + * Method: ARGB32 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getARGBPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_ARGB32 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getAYUVPixelFormat - * Signature: ()J + * Method: AYUV + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getAYUVPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_AYUV (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getI420PixelFormat - * Signature: ()J + * Method: I420 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getI420PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_I420 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIF09PixelFormat - * Signature: ()J + * Method: IF09 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIF09PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IF09 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIMC1PixelFormat - * Signature: ()J + * Method: IMC1 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC1PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IMC1 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIMC2PixelFormat - * Signature: ()J + * Method: IMC2 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC2PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IMC2 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIMC3PixelFormat - * Signature: ()J + * Method: IMC3 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC3PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IMC3 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIMC4PixelFormat - * Signature: ()J + * Method: IMC4 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIMC4PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IMC4 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getIYUVPixelFormat - * Signature: ()J + * Method: IYUV + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getIYUVPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_IYUV (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getNV12PixelFormat - * Signature: ()J + * Method: NV12 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getNV12PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_NV12 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getRGB24PixelFormat - * Signature: ()J + * Method: RGB24 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getRGB24PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_RGB24 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getRGB32PixelFormat - * Signature: ()J + * Method: RGB32 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getRGB32PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_RGB32 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getUYVYPixelFormat - * Signature: ()J + * Method: UYVY + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getUYVYPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_UYVY (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getY211PixelFormat - * Signature: ()J + * Method: Y211 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY211PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_Y211 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getY411PixelFormat - * Signature: ()J + * Method: Y411 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY411PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_Y411 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getY41PPixelFormat - * Signature: ()J + * Method: Y41P + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getY41PPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_Y41P (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getYUY2PixelFormat - * Signature: ()J + * Method: YUY2 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYUY2PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_YUY2 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getYV12PixelFormat - * Signature: ()J + * Method: YV12 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYV12PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_YV12 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getYVU9PixelFormat - * Signature: ()J + * Method: YVU9 + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYVU9PixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_YVU9 (JNIEnv *, jclass); /* * Class: org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat - * Method: getYVYUPixelFormat - * Signature: ()J + * Method: YVYU + * Signature: ()I */ -JNIEXPORT jlong JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_getYVYUPixelFormat +JNIEXPORT jint JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSFormat_YVYU (JNIEnv *, jclass); #ifdef __cplusplus diff --git a/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java b/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java index 76ecce05214eb8dfda4c03ffd9c7d8aa7f58d7af..f9c854994adaa2cb0b8db56bb82b86f6ae1d3855 100644 --- a/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java +++ b/src/org/jitsi/impl/neomedia/codec/video/AVFrameFormat.java @@ -266,9 +266,16 @@ public String toString() StringBuilder s = new StringBuilder(super.toString()); if (pixFmt != NOT_SPECIFIED) - s.append(", pixFmt= ").append(pixFmt); + s.append(", pixFmt ").append(pixFmt); if (deviceSystemPixFmt != NOT_SPECIFIED) - s.append(", deviceSystemPixFmt= ").append(deviceSystemPixFmt); + { + s.append(", deviceSystemPixFmt 0x"); + /* + * The value is likely more suitably displayed as unsigned and + * hexadecimal. + */ + s.append(Long.toHexString(deviceSystemPixFmt & 0xffffffffL)); + } return s.toString(); } } diff --git a/src/org/jitsi/impl/neomedia/device/DirectShowSystem.java b/src/org/jitsi/impl/neomedia/device/DirectShowSystem.java index a58e8922c376a7a99ec8d25a54713c55e47ca311..0cd5a63931e59599874df2b3bbdc04c45ea6640e 100644 --- a/src/org/jitsi/impl/neomedia/device/DirectShowSystem.java +++ b/src/org/jitsi/impl/neomedia/device/DirectShowSystem.java @@ -84,16 +84,13 @@ protected void doInitialize() for (DSFormat dsFormat : dsFormats) { - long pixelFormat = dsFormat.getPixelFormat(); - int ffmpegPixFmt - = (int) DataSource.getFFmpegPixFmt(pixelFormat); + int pixelFormat = dsFormat.getPixelFormat(); + int ffmpegPixFmt = DataSource.getFFmpegPixFmt(pixelFormat); if (ffmpegPixFmt != FFmpeg.PIX_FMT_NONE) { Format format - = new AVFrameFormat( - ffmpegPixFmt, - (int) pixelFormat); + = new AVFrameFormat(ffmpegPixFmt, pixelFormat); if (!formats.contains(format)) formats.add(format); diff --git a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat.java b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat.java index 0df59af6bb81cacee9c87610a235cc5b87bb2464..4a136373e50cb476ccfd01c5d31f0751b663f932 100644 --- a/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat.java +++ b/src/org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat.java @@ -6,10 +6,13 @@ */ package org.jitsi.impl.neomedia.jmfext.media.protocol.directshow; +import javax.media.*; + /** * DirectShow video format. * * @author Sebastien Vincent + * @author Lyubomir Marinov */ public class DSFormat { @@ -17,220 +20,117 @@ public class DSFormat /** * The ARGB32 constant. */ - public static final long ARGB32; + public static final int ARGB32; /** * The I420 constant. */ - public static final long I420; + public static final int I420; /** * The NV12 constant. */ - public static final long NV12; + public static final int NV12; /** * The RGB24 constant. */ - public static final long RGB24; + public static final int RGB24; /** * The RGB32 constant. */ - public static final long RGB32; + public static final int RGB32; /** * The UYVY constant. */ - public static final long UYVY; + public static final int UYVY; /** * The Y411 constant. */ - public static final long Y411; + public static final int Y411; /** * The Y41P constant. */ - public static final long Y41P; + public static final int Y41P; /** * The YUY2 constant. */ - public static final long YUY2; + public static final int YUY2; static { System.loadLibrary("jndirectshow"); - RGB24 = getRGB24PixelFormat(); - RGB32 = getRGB32PixelFormat(); - ARGB32 = getARGBPixelFormat(); - YUY2 = getYUY2PixelFormat(); - UYVY = getUYVYPixelFormat(); - NV12 = getNV12PixelFormat(); - Y411 = getY411PixelFormat(); - Y41P = getY41PPixelFormat(); - I420 = getI420PixelFormat(); + RGB24 = RGB24(); + RGB32 = RGB32(); + ARGB32 = ARGB32(); + YUY2 = YUY2(); + UYVY = UYVY(); + NV12 = NV12(); + Y411 = Y411(); + Y41P = Y41P(); + I420 = I420(); } - /** - * Get the ARGB32 native pixel format - * - * @return ARGB32 native format value - */ - public static native long getARGBPixelFormat(); + private static native int ARGB32(); - /** - * Get the AYUV native pixel format - * - * @return AYUV native format value - */ - public static native long getAYUVPixelFormat(); + public static native int AYUV(); - /** - * Get the I420 native pixel format - * - * @return I420 native format value - */ - public static native long getI420PixelFormat(); + private static native int I420(); - /** - * Get the IF09 native pixel format - * - * @return IF09 native format value - */ - public static native long getIF09PixelFormat(); + public static native int IF09(); - /** - * Get the IMC1 native pixel format - * - * @return IMC1 native format value - */ - public static native long getIMC1PixelFormat(); + public static native int IMC1(); - /** - * Get the IMC2 native pixel format - * - * @return IMC2 native format value - */ - public static native long getIMC2PixelFormat(); + public static native int IMC2(); - /** - * Get the IMC3 native pixel format - * - * @return IMC3 native format value - */ - public static native long getIMC3PixelFormat(); + public static native int IMC3(); - /** - * Get the IMC4 native pixel format - * - * @return IMC4 native format value - */ - public static native long getIMC4PixelFormat(); + public static native int IMC4(); - /** - * Get the IYUV native pixel format - * - * @return IYUV native format value - */ - public static native long getIYUVPixelFormat(); + public static native int IYUV(); - /** - * Get the NV12 native pixel format - * - * @return NV12 native format value - */ - public static native long getNV12PixelFormat(); + private static native int NV12(); - /* YUV */ + private static native int RGB24(); - /* RGB */ - /** - * Get the RGB24 native pixel format - * - * @return RGB24 native format value - */ - public static native long getRGB24PixelFormat(); - - /** - * Get the RGB32 native pixel format - * - * @return RGB32 native format value - */ - public static native long getRGB32PixelFormat(); + private static native int RGB32(); - /** - * Get the UYVY native pixel format - * - * @return UYVY native format value - */ - public static native long getUYVYPixelFormat(); + private static native int UYVY(); - /** - * Get the Y211 native pixel format - * - * @return Y211 native format value - */ - public static native long getY211PixelFormat(); + public static native int Y211(); - /** - * Get the Y411 native pixel format - * - * @return Y411 native format value - */ - public static native long getY411PixelFormat(); + private static native int Y411(); - /** - * Get the Y41P native pixel format - * - * @return Y41P native format value - */ - public static native long getY41PPixelFormat(); + private static native int Y41P(); - /** - * Get the YUY2 native pixel format - * - * @return YUY2 native format value - */ - public static native long getYUY2PixelFormat(); + private static native int YUY2(); - /** - * Get the YV12 native pixel format - * - * @return YV12 native format value - */ - public static native long getYV12PixelFormat(); + public static native int YV12(); - /** - * Get the YVU9 native pixel format - * - * @return YVU9 native format value - */ - public static native long getYVU9PixelFormat(); + public static native int YVU9(); - /** - * Get the YVYU native pixel format - * - * @return YVYU native format value - */ - public static native long getYVYUPixelFormat(); + public static native int YVYU(); /** * Video height. */ - private int height = 0; + private final int height; /** * Color space. */ - private long pixelFormat = -1; + private final int pixelFormat; /** * Video width. */ - private int width = 0; + private final int width; /** * Constructor. @@ -239,7 +139,7 @@ public class DSFormat * @param height video height * @param pixelFormat pixel format */ - public DSFormat(int width, int height, long pixelFormat) + public DSFormat(int width, int height, int pixelFormat) { this.width = width; this.height = height; @@ -261,7 +161,7 @@ public int getHeight() * * @return color space */ - public long getPixelFormat() + public int getPixelFormat() { return pixelFormat; } @@ -275,4 +175,26 @@ public int getWidth() { return width; } + + @Override + public String toString() + { + StringBuilder s = new StringBuilder(getClass().getName()); + + if (pixelFormat != Format.NOT_SPECIFIED) + { + s.append(", pixelFormat 0x"); + /* + * The value of pixelFormat is GUID.Data1 which is a DWORD i.e. a + * 32-bit unsigned integer). The most suitable display is surely + * hexadecimal. + */ + s.append(Long.toHexString(pixelFormat & 0xffffffffL)); + } + if (width != Format.NOT_SPECIFIED) + s.append(", width ").append(width); + if (height != Format.NOT_SPECIFIED) + s.append(", height ").append(height); + return s.toString(); + } } 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 c26d6111ee2e3b3aebed63aed5b157fb241e3fb6..6b5c6b849dad6822d2ef59f2b0da12585a811888 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,8 +35,8 @@ public class DataSource * The map of DirectShow pixel formats to FFmpeg pixel formats which allows * converting between the two. */ - private static final long[] DS_TO_FFMPEG_PIX_FMTS - = new long[] + private static final int[] DS_TO_FFMPEG_PIX_FMTS + = new int[] { DSFormat.RGB24, FFmpeg.PIX_FMT_RGB24, @@ -71,7 +71,7 @@ public class DataSource * @param ffmpegPixFmt FFmpeg format * @return the DirectShow pixel format matching the specified FFmpeg format */ - public static long getDSPixFmt(int ffmpegPixFmt) + public static int getDSPixFmt(int ffmpegPixFmt) { for (int i = 0; i < DS_TO_FFMPEG_PIX_FMTS.length; i += 2) if (DS_TO_FFMPEG_PIX_FMTS[i + 1] == ffmpegPixFmt) @@ -87,7 +87,7 @@ public static long getDSPixFmt(int ffmpegPixFmt) * FFmpeg pixel format of * @return the FFmpeg pixel format matching the specified DirectShow pixel */ - public static long getFFmpegPixFmt(long dsPixFmt) + public static int getFFmpegPixFmt(int dsPixFmt) { for (int i = 0; i < DS_TO_FFMPEG_PIX_FMTS.length; i += 2) if (DS_TO_FFMPEG_PIX_FMTS[i] == dsPixFmt) @@ -381,14 +381,14 @@ protected Format[] getSupportedFormats(int streamIndex) { Dimension size = new Dimension(deviceFmt.getWidth(), deviceFmt.getHeight()); - long devicePixFmt = deviceFmt.getPixelFormat(); - int pixFmt = (int) getFFmpegPixFmt(devicePixFmt); + int devicePixFmt = deviceFmt.getPixelFormat(); + int pixFmt = getFFmpegPixFmt(devicePixFmt); fmts.add( new AVFrameFormat( size, Format.NOT_SPECIFIED, - pixFmt, (int) devicePixFmt)); + pixFmt, devicePixFmt)); } return fmts.toArray(new Format[fmts.size()]); }