[FFmpeg-devel] [PATCH] cmdutils: dont call read_header before listing devices

Michael Niedermayer michaelni at gmx.at
Mon Dec 15 14:18:50 CET 2014


On Mon, Dec 15, 2014 at 12:36:49AM +0100, Lukasz Marek wrote:
> On 15.12.2014 00:33, 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 <lukasz.m.luki2 at gmail.com>
> >---
> >  cmdutils.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> >diff --git a/cmdutils.c b/cmdutils.c
> >index 06ce5d5..51fd777 100644
> >--- a/cmdutils.c
> >+++ b/cmdutils.c
> >@@ -2069,9 +2069,8 @@ 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);
> >+    dev->flags |= AVFMT_FLAG_PRIV_OPT;
> >      if ((ret = avformat_open_input(&dev, NULL, fmt, &tmp_opts)) < 0) {
> >          printf("Cannot open device: %s.\n", fmt->name);
> >          goto fail;
> >
> 
> I forgot to amend. Updated patch attached.

>  cmdutils.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 8d012a5193b0440717f89d920661913ef160e674  0001-cmdutils-dont-call-read_header-before-listing-device.patch
> From 332bb7456c498518ea72dfdaa0e8c3e76d383f21 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Mon, 15 Dec 2014 00:31:42 +0100
> Subject: [PATCH] cmdutils: dont call read_header before listing devices
> 
> 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.

should be ok

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141215/732132b8/attachment.asc>


More information about the ffmpeg-devel mailing list