problem with JMF and capture device - applet

i try to use JMF on applet for read data from webcam . but in below code :
String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
di = CaptureDeviceManager.getDevice(str2);
ml = di.getLocator();
Capturedevicemanager.getdevice(str2); method returned null value .
tnx

Related

Pjsip/Pjsua video problem : frame buffer too small

I try to make a sip video call using Pjsip/Pjsua on my raspberry pi 3.
Before coding, I'm using the main sample app to test different options. Everything seems to work (registering, audio calling,..) but when I try to start a video call, the programs stops with the following message :
pjsua-armv7l-unknown-linux-gnueabihf: ../src/pjmedia-videodev/v4l2_dev.c:737: vid4lin_stream_get_frame_mmap: Assertion `!"frame buffer is too small for v4l2"' failed.
I've searched a lot, including the source code :
/* get frame from mmap */
static pj_status_t vid4lin_stream_get_frame_mmap(vid4lin_stream *stream, pjmedia_frame *frame)
{
struct v4l2_buffer buf;
pj_time_val time;
pj_status_t status = PJ_SUCCESS;
pj_bzero(&buf, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
status = xioctl(stream->fd, VIDIOC_DQBUF, &buf);
if (status != PJ_SUCCESS)
return status;
if (frame->size < buf.bytesused) {
/* supplied buffer is too small */
pj_assert(!"frame buffer is too small for v4l2");
status = PJ_ETOOSMALL;
goto on_return;
}
So I understand that the pjmedia_frame has a "size" inferior to the v4l2 buffer, resulting to my failure.
My question is simple : how can i change this setting ?
I tried evetything in the sample app : changing resolution, bitrate, fps,..
I found some ressources saying to change the h264 profile level.. ok, but where do i set it ? Is it within the v4l2 manager ? or directly in the app ? How can i do it ?
I played with different options in v4l2 to reduce the bitrate/resolution in order to have a small buffer, but still getting the same error.
At this point I'm completely clueless.
For info, I compiled PJsip using openh264 (no libx264) as suggested by PjSip.
Thanks for your help/ideas ;)
According to your question about profile level, you can try with:
const pj_str_t codec_id = {"H264", 4};
pjmedia_vid_codec_param param;
pj_status_t status;
status = pjsua_vid_codec_get_param(&codec_id, &param);
param.dec_fmtp.param[0].name = pj_str("profile-level-id");
param.dec_fmtp.param[0].val = pj_str("42e01f");
status = pjsua_vid_codec_set_param(&codec_id, &param);
do this anywhere after pjsua_start(). Last two characters in val property are profile level. Description of levels can be found here (link). More information about h264 profile here (link).
I'm not an expert of v4l2, but have little experience with encoding video on rpi3, and I suggest you to use FFmpeg instead of pure openh264, beacuse of support of hardware acceleration (link).
Good luck!

Using MailKit's Smtpclient to send,subjectEncoding is weird in the source of received email.

I tried to encode them to iso-2022-jp correctly,but the only subject is slightly unexpected.
Here's the result.
From: =?iso-2022-jp?B?GyRCJ**************==?= <sender#example.com>
To: =?iso-2022-jp?B?GyRCS****************==?= <receiver#example.com>
Subject: =?iso-2022-jp?b?GyRCQmpMPhsoQjobJEIlRiU5JUgbKEI=?=
As you see above,lower case "b" is only seen in Subject even though I encoded the others in the same way.
I found out that it's automatically converted to b right after the method smtp.Send(msg);
b isn't commonly seen.I need to fix it to B.
Below is like what I tried to do.
using (var smtp = new SmtpClient())
{
//Connection
.
.
.
//Set from,to,subject,body...
.
.
msg.Subject = EncodeMailHeader("題名:テスト");
.
.
smtp.Send(msg);
}
// Convert to "=?iso-2022-jp?B?<encodedstring>?="
private static string EncodeMailHeader(string val)
{
Encoding enc = Encoding.GetEncoding(JIS_Code);
string strBase64 = Convert.ToBase64String(enc.GetBytes(val));
return string.Format("=?{0}?B?{1}?=", enc.HeaderName, strBase64);
}
Subject property of "msg" is "=?iso-2022-jp?B?GyRCQmpMPhsoQjobJEIlRiU5JUgbKEI=?=" at the point of debugging smtp.Send(msg);.
I don't know why it will change after this.
I need someone to help me.Thanks in advance.

Sending String command to BLE in Ionic

im new in ionic, right now i'm trying to send a "code" in string.
which the string consist of a few packets data in HEX.
eg. V1-FC03-2ED1-FE01
V1 is the sequence, then after the first - is the first packet "FC03"
the code successfully send to my arduino using serial monitor on pc.
arduino serial monitor
now i want to send it trough BLE using ionic.
i follow the example on github on doing the BLE.
it works if send 1 or 0.
here is the function in ionic codes that going to send to arduino after button pressed
onPowerSwitchChange(event) {
console.log('onPowerSwitchChange');
let value = this.power ? 1 : 0;
let buffer = new Uint8Array([value]).buffer;
console.log('Power Switch Property ' + this.power);
this.ble.write(this.peripheral.id, LIGHTBULB_SERVICE, SWITCH_CHARACTERISTIC, buffer).then(
() => this.setStatus('Light is ' + (this.power ? 'on' : 'off')),
e => this.showAlert('Unexpected Error', 'Error updating power switch')
);
}
here i tried to change
let value = this.power ? 1 : 0;
to
let value = "V1-FC03-2ED1-FE01";
but when compile, got error
Argument of type 'string[]' is not assignable to parameter of type 'ArrayBuffer'. Property 'byteLength' is
missing in type 'string[]'.
L68: let value = "V1-FC03-2ED1-FE01";
L69: let buffer = new Uint8Array([value]).buffer;
L70: console.log('Power Switch Property ' + this.power);
hopefully someone can help me on this problem
Not sure if this will help you as I'm not a programmer by trade... but I wanted to send a "2" as string and it turned out that I had to do it like this:
var data = new Uint8Array(1);
data[0] = 50;
With 50 being the Uint8Array equivalent of 2
Currently I'm trying to read from the BLE in the opposite direction to no effect so please keep us posted as to your progress.

IONotificationPortCreate not working in Swift

Trying to do some Swift stuff. Converting some USB device detection code from Objective-C to Swift. Having a problem with getting the Notification port. IONotificationPortCreate returns a Unmanaged<'IONotificationPort'>! and when the program runs it hangs on line 2 below and I then printed out the description of notify and notifyPort below. I don't know if it's not getting the port or if I'm not getting it out of that Unmanaged <'IONotificationPort'>! correctly or something else is wrong
var notify = IONotificationPortCreate(kIOMasterPortDefault)
var notifyPort = notify.takeRetainedValue() as IONotificationPortRef
Printing description of notify: (Unmanaged<'IONotificationPort'>!) notify = (_value = <no summary available>)
Printing description of notifyPort: (IONotificationPortRef) notifyPort = 0x000000010050e620 {}
Thanks for any help,
Chris

Facebook & Classic ASP - Passing custom parameters to fan page tab - error with no data

We have our app working using this code (Is it possibile to pass parameters to the callback URL of a FB app which is accessed through a tab?), but the issue arises when there is no app_data parameter passed in. Here is an example of what we mean:
Works Fine: ("test" is written out fine)
https://www.facebook.com/phillypours/app_397493550309543?app_data=test
Does NOT Work:
https://www.facebook.com/phillypours/app_397493550309543
Code used with Base64 Encode & JSON Decode:
myArray = Split(Request("signed_request"), ".")
encoded_sig = myArray(0)
payload = myArray(1)
sig = base64_decode(Replace(encoded_sig, "-_", "+/"))
set data = JSON.parse(base64_decode(Replace(payload, "-_", "+/")))
Response.Write data.app_data
This is the error we receive when no parameter is passed in:
Object doesn't support this property or method: 'data.app_data'
Anyone have any thoughts on how to trap for this? I cannot do anything with "data.app_data" since this is what throws the error.
Any help would be greatly appreciated!!!
Thank you.
Dennis
I found a work around for this. Wanted to share to others could benefit. thanks, Dennis
<!--#INCLUDE VIRTUAL="/includes/fb_base64.asp"-->
<!--#INCLUDE VIRTUAL="/includes/fb_json_decode.asp"-->
Function parsePageSignedRequest()
If Request("signed_request") <> "" Then
myArray = Split(Request("signed_request"), ".")
payload = myArray(1)
payload_decoded = base64_decode(payload)
set data = JSON.parse(payload_decoded)
If instr(payload_decoded,"""app_data""") Then
AppData = data.app_data
End If
If instr(payload_decoded,"liked"":true,") Then
LikeStatus = True
End If
End If
End Function