Re: [Libav-user] Querying v4l2 devices

2016-09-17 Thread Timur Guseynov
avdevice_list_input_sources works.

Thank you!

сб, 17 сент. 2016 г. в 1:33, Lukasz Marek :

> On 17.09.2016 00:08, Lukasz Marek wrote:
> > I guess input device private data is not initialized, try to add this
> > code right after formatContext->iformat=inputFormat, just replace s with
> > formatContext
> >
> > if (s->iformat->priv_data_size > 0) {
> > s->priv_data = av_mallocz(s->iformat->priv_data_size);
> > if (s->iformat->priv_class) {
> > *(const AVClass**)s->priv_data= s->iformat->priv_class;
> > av_opt_set_defaults(s->priv_data);
> > }
> > } else
> > s->priv_data = NULL;
> >
> >
> > Maybe ff_alloc_input_device_context function should be moved to
> > libavdevice's public API
>
> Ignore this answer, it should work but manipulates private fields
> You should use avdevice_list_input_sources. If still not working then
> please attach some *.c file so i can test it locally.
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Querying v4l2 devices

2016-09-16 Thread Lukasz Marek

On 17.09.2016 00:08, Lukasz Marek wrote:

I guess input device private data is not initialized, try to add this
code right after formatContext->iformat=inputFormat, just replace s with
formatContext

if (s->iformat->priv_data_size > 0) {
s->priv_data = av_mallocz(s->iformat->priv_data_size);
if (s->iformat->priv_class) {
*(const AVClass**)s->priv_data= s->iformat->priv_class;
av_opt_set_defaults(s->priv_data);
}
} else
s->priv_data = NULL;


Maybe ff_alloc_input_device_context function should be moved to
libavdevice's public API


Ignore this answer, it should work but manipulates private fields
You should use avdevice_list_input_sources. If still not working then 
please attach some *.c file so i can test it locally.

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Querying v4l2 devices

2016-09-16 Thread Lukasz Marek

On 16.09.2016 23:39, Timur Guseynov wrote:

Hi. I wrote the code for getting a list of input devices:

avdevice_register_all();


AVFormatContext*formatContext=avformat_alloc_context();

AVInputFormat*inputFormat=NULL;

while((inputFormat=av_input_video_device_next(inputFormat)))

{

formatContext->iformat=inputFormat;


AVDeviceInfoList*deviceList=NULL;

avdevice_list_devices(formatContext,&deviceList);


if(deviceList)

{

for(inti=0;inb_devices;++i)

{

AVDeviceInfo*device=deviceList->devices[i];

..

}

}


avdevice_free_list_devices(&deviceList);

 }


It fails with SIGSEGV on avdevice_list_devices when it comes to v4l2 input 
format.
Why does it fail?
How can I get list of video devices?

Btw I'm using Ubuntu 16.04


I guess input device private data is not initialized, try to add this 
code right after formatContext->iformat=inputFormat, just replace s with 
formatContext


if (s->iformat->priv_data_size > 0) {
s->priv_data = av_mallocz(s->iformat->priv_data_size);
if (s->iformat->priv_class) {
*(const AVClass**)s->priv_data= s->iformat->priv_class;
av_opt_set_defaults(s->priv_data);
}
} else
s->priv_data = NULL;


Maybe ff_alloc_input_device_context function should be moved to 
libavdevice's public API

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


[Libav-user] Querying v4l2 devices

2016-09-16 Thread Timur Guseynov
Hi. I wrote the code for getting a list of input devices:

 avdevice_register_all();


AVFormatContext *formatContext = avformat_alloc_context();

AVInputFormat *inputFormat = NULL;

while((inputFormat = av_input_video_device_next(inputFormat)))

{

formatContext->iformat = inputFormat;


AVDeviceInfoList *deviceList = NULL;

avdevice_list_devices(formatContext, &deviceList);


if(deviceList)

{

for(int i = 0; i < deviceList->nb_devices; ++i)

{

AVDeviceInfo *device = deviceList->devices[i];

..

}

}


   avdevice_free_list_devices(&deviceList);

 }


It fails with SIGSEGV on avdevice_list_devices when it comes to v4l2
input format.


Why does it fail?

How can I get list of video devices?


Btw I'm using Ubuntu 16.04
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user