Re: [FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources

2015-01-11 Thread Lukasz Marek

On 03.01.2015 06:35, Michael Niedermayer wrote:

On Sat, Jan 03, 2015 at 04:45:56AM +0100, Lukasz Marek wrote:

On 21 December 2014 at 21:04, Lukasz Marek  wrote:


List device callback must be able to return valid list without opening
device.
This callback should return input values for open function, not vice-versa.
Read header funtion is very likey to fail without proper configuration
provided.

Signed-off-by: Lukasz Marek 
---
  cmdutils.c | 27 ++-
  1 file changed, 2 insertions(+), 25 deletions(-)



ping on patchset


in absence of other comments, i think these 2 patches should be ok


pushed both

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources

2015-01-02 Thread Michael Niedermayer
On Sat, Jan 03, 2015 at 04:45:56AM +0100, Lukasz Marek wrote:
> On 21 December 2014 at 21:04, Lukasz Marek  wrote:
> 
> > List device callback must be able to return valid list without opening
> > device.
> > This callback should return input values for open function, not vice-versa.
> > Read header funtion is very likey to fail without proper configuration
> > provided.
> >
> > Signed-off-by: Lukasz Marek 
> > ---
> >  cmdutils.c | 27 ++-
> >  1 file changed, 2 insertions(+), 25 deletions(-)
> >
> 
> ping on patchset

in absence of other comments, i think these 2 patches should be ok

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources

2015-01-02 Thread Lukasz Marek
On 21 December 2014 at 21:04, Lukasz Marek  wrote:

> List device callback must be able to return valid list without opening
> device.
> This callback should return input values for open function, not vice-versa.
> Read header funtion is very likey to fail without proper configuration
> provided.
>
> Signed-off-by: Lukasz Marek 
> ---
>  cmdutils.c | 27 ++-
>  1 file changed, 2 insertions(+), 25 deletions(-)
>

ping on patchset
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] cmdutils: use helper functions for listing sinks/sources

2014-12-21 Thread Lukasz Marek
List device callback must be able to return valid list without opening device.
This callback should return input values for open function, not vice-versa.
Read header funtion is very likey to fail without proper configuration provided.

Signed-off-by: Lukasz Marek 
---
 cmdutils.c | 27 ++-
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 2b4ab9e..fb1883a 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -2076,9 +2076,7 @@ void *grow_array(void *array, int elem_size, int *size, 
int new_size)
 static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
 {
 int ret, i;
-AVFormatContext *dev = NULL;
 AVDeviceInfoList *device_list = NULL;
-AVDictionary *tmp_opts = NULL;
 
 if (!fmt || !fmt->priv_class  || 
!AV_IS_INPUT_DEVICE(fmt->priv_class->category))
 return AVERROR(EINVAL);
@@ -2090,15 +2088,7 @@ static int print_device_sources(AVInputFormat *fmt, 
AVDictionary *opts)
 goto fail;
 }
 
-/* TODO: avformat_open_input calls read_header callback which is not 
necessary.
- Function like avformat_alloc_output_context2 for input could be 
helpful here. */
-av_dict_copy(&tmp_opts, opts, 0);
-if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {
-printf("Cannot open device: %s.\n", fmt->name);
-goto fail;
-}
-
-if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {
+if ((ret = avdevice_list_input_sources(fmt, NULL, opts, &device_list)) < 
0) {
 printf("Cannot list sources.\n");
 goto fail;
 }
@@ -2109,18 +2099,14 @@ static int print_device_sources(AVInputFormat *fmt, 
AVDictionary *opts)
 }
 
   fail:
-av_dict_free(&tmp_opts);
 avdevice_free_list_devices(&device_list);
-avformat_close_input(&dev);
 return ret;
 }
 
 static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)
 {
 int ret, i;
-AVFormatContext *dev = NULL;
 AVDeviceInfoList *device_list = NULL;
-AVDictionary *tmp_opts = NULL;
 
 if (!fmt || !fmt->priv_class  || 
!AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))
 return AVERROR(EINVAL);
@@ -2132,14 +2118,7 @@ static int print_device_sinks(AVOutputFormat *fmt, 
AVDictionary *opts)
 goto fail;
 }
 
-if ((ret = avformat_alloc_output_context2(&dev, fmt, NULL, NULL)) < 0) {
-printf("Cannot open device: %s.\n", fmt->name);
-goto fail;
-}
-av_dict_copy(&tmp_opts, opts, 0);
-av_opt_set_dict2(dev, &tmp_opts, AV_OPT_SEARCH_CHILDREN);
-
-if ((ret = avdevice_list_devices(dev, &device_list)) < 0) {
+if ((ret = avdevice_list_output_sinks(fmt, NULL, opts, &device_list)) < 0) 
{
 printf("Cannot list sinks.\n");
 goto fail;
 }
@@ -2150,9 +2129,7 @@ static int print_device_sinks(AVOutputFormat *fmt, 
AVDictionary *opts)
 }
 
   fail:
-av_dict_free(&tmp_opts);
 avdevice_free_list_devices(&device_list);
-avformat_free_context(dev);
 return ret;
 }
 
-- 
1.9.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel