Hi Nvidia,
I want to detect which all audio device connected to Tx2 BOARD, and which of them are recording.
kindly any one can guide how to go about, i tried many thing but didn’t worked. Below are the details.
Kindly help ,thanks
I have done for video device connected like (HDMI input camera & USB camera) using APIS.
But not able to do for audio status or audio capabilities.
for like video:
Video Src detection
snprintf(cBuff,CAM_BUFF_LEN,"/dev/video%d",nVIdx);
if((nFd = open(cBuff, O_RDONLY)) == -1)
{
}
if (ioctl(nFd,VIDIOC_G_INPUT , &nIndex) == -1)
{
perror("\n VIDIOC_G_INPUT FAILURE \n");
}
if (ioctl(nFd, VIDIOC_ENUMINPUT, &stInput) == -1)
{
perror("\n VIDIOC_ENUMINPUT FAILURE \n");
}
Video src capabilities:
stFmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
while ((nRet = ioctl(nCamera_fd, VIDIOC_ENUM_FMT, &stFmtdesc)) == 0)
{
sCamFmt = stFmtdesc.pixelformat & 0xFF;
sCamFmt += (stFmtdesc.pixelformat >> 8) & 0xFF;
sCamFmt += (stFmtdesc.pixelformat >> 16) & 0xFF;
sCamFmt += (stFmtdesc.pixelformat >> 24) & 0xFF;
}
stFmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(nCamera_fd, VIDIOC_G_FMT, &stFmt) < 0)
{
nReturn = FAILURE;
}
for like Audio:I have tried using VIDIOC_ENUMAUDIO but getting this error.
: Inappropriate ioctl for devic
struct v4l2_audio audio;
snprintf(cBuff,CAM_BUFF_LEN,"/dev/video%d",nVIdx);
if((nFd = open(cBuff, O_RDONLY)) == -1)
{
if(nVIdx == 0)
{
perror("\n No Cam device Found \n");
}
close(nFd);
break;
}
if (ioctl(nFd,VIDIOC_G_INPUT , &nIndex) == -1)
{
perror("\n VIDIOC_G_INPUT FAILURE \n");
}
memset(&audio, 0, sizeof(audio));
audio.index = nIndex;
// VIDIOC_ENUMINPUT VIDIOC_ENUMAUDIO
if (ioctl(nFd, VIDIOC_ENUMAUDIO , &stInput) == -1)
{
perror("\n VIDIOC_ENUMAUDIO FAILURE \n");
}
[b]For audio src Detection : ?
For audio capabilities : ?[/b]