I wan to detect audio sources connected to Tx2 using program ioctl/gstreamer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I wan to detect audio sources connected to Tx2 using program ioctl/gstreamer

new baby

Hi Experts,


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.


*1st Method *
int main ()
{
        GstDeviceMonitor *Monitor;
        GstCaps *caps;
        GstDevice *device;
        GList *devlist = NULL, *devIter;
        gchar *devString;
        int   n = 1; // Start input index is 1 for class 0.


        Monitor = gst_device_monitor_new ();
        printf("\n PTB-INFO: 1 \n");
        caps = gst_caps_new_empty_simple("audio/x-raw");
        printf("\n PTB-INFO: 2 \n");
        gst_device_monitor_add_filter(Monitor, "Audio/Source", NULL);
        printf("\n PTB-INFO: 3 \n");
        gst_caps_unref(caps);
        devlist = gst_device_monitor_get_devices (Monitor);
        printf("\n PTB-INFO:  \n");

        if (!gst_device_monitor_start(Monitor))
        {
                printf("\n PTB-INFO: GstDeviceMonitor unsupported. May not be able to
enumerate all video devices.\n");
        }
        else
        {
                devlist = gst_device_monitor_get_devices(Monitor);

                for (devIter = g_list_first(devlist); devIter != NULL; devIter =
g_list_next(devIter))
                {
                        device = (GstDevice*) devIter->data;
                        if (device == NULL)
                                continue;
                        // Probe all device properties and store them in internal global
videocapture device array:
                        devString = gst_device_get_device_class(device);
                        printf("\n  enumerate all audio  devices %s \n",devString);
                        g_free(devString);

                        // Increment count of detected devices for this plugin:
                        n++;
                        // Increment count of total detected devices for all
plugins so far:
                        ntotal++;

                       if (ntotal >= PSYCH_MAX_VIDSRC - 2)
                      {
                              if (PsychPrefStateGet_Verbosity() > 1)
                                      printf("PTB-WARNING: Maximum number of
allowable video sources during enumeration %i r eached! Aborting
enumeration.\n", PSYCH_MAX_VIDSRC);
break;
                       }
                g_list_free(devlist);
                gst_device_monitor_stop(Monitor);
        }
        gst_object_unref(GST_OBJECT(Monitor));

        return 1;
}


*2nd Method*


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");
    }






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
adi