[FFmpeg-devel] [PATCH 1/4] lavf: add probe device API
Michael Niedermayer
michaelni at gmx.at
Sun Jan 26 20:32:34 CET 2014
On Sun, Jan 26, 2014 at 07:40:56PM +0100, Nicolas George wrote:
> Le sextidi 6 pluviôse, an CCXXII, Lukasz Marek a écrit :
> > >From c1e66d75f698fbd301743cd0664733a5d48f03e8 Mon Sep 17 00:00:00 2001
> > From: Lukasz Marek <lukasz.m.luki at gmail.com>
> > Date: Sat, 25 Jan 2014 22:46:03 +0100
> > Subject: [PATCH] lavd: add probe device API
> >
> > ---
> > libavformat/avformat.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 103 insertions(+)
> >
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index a495ee0..0ff4560 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -323,6 +323,101 @@ typedef struct AVFrac {
> > int64_t val, num, den;
> > } AVFrac;
> >
>
> > +//TODO: Move this stuff to libavdevice.
>
> I wonder. Being able to query the list of codecs supported by RTP, for
> example, would be nice.
also its a bit redudant with query_codec()
>
> > +
> > +/**
> > + * TODO: desc
> > + */
> > +typedef struct AVDeviceFormat
> > +{
> > + enum AVCodecID codec; /**< codec */
> > + int *formats; /**< list of formats supported with codec.
> > + AVPixelFormat/AVSampleFormat terminated with -1 */
> > +} AVDeviceFomat;
>
> First, I suggest, here and everywhere, to replace "terminated with X" lists
> with a count indicator: "int *formats; unsigned nb_formats;". I believe this
> is more practical for everyone. Also, some list are terminated by -1, some
> by 0, some by NULL, that takes effort to remember.
>
> Second, I am not sure whether codec/format is the only pair that needs to be
> linked. That is the most obvious one, but I can easily imagine a camera with
> limited bandwidth supporting 50 FPS in MJPEG mode but only 30 FPS in
> RAWVIDEO mode.
+1
also see AVClass.query_ranges() and av_opt_query_ranges()
its more generic and simpler
>
> Basically, we have the full Cartesian product:
> CODECS × PIXEL_FORMAT × RESOLUTIONS × FRAME_RATES
> CODECS × SAMPLE_FORMAT × CHANNEL_COUNTS × SAMPLE_RATES
> and we need to be able to express a part of the set.
>
> The obvious simple idea is to consider that the subset is itself a Cartesian
> product:
>
> SUPPORTED_FORMATS × SUPPORTED_RESOLUTIONS × SUPPORTED_FRAME_RATES \subset
> PIXEL_FORMAT × RESOLUTIONS × FRAME_RATES
>
> Except for CODECS and FORMAT, because they always are strongly linked.
>
> I can suggest two solutions, one simple and one powerful.
>
> The simple one: each device can return a small list of AVDeviceCapabilities.
> Each device expands its list the way it is most convenient. For example:
>
> [
> { codec = MJPEG, format = YUV420, list of supported resolutions and rates },
> { codec = MJPEG, format = YUV422, list of supported resolutions and rates },
> { codec = RAWVIDEO, format = RGB, list of supported resolutions and rates },
> ]
>
> The powerful one: the AVDeviceCapabilities can leave fields unset and point
> to a list of AVDeviceCapabilities to define them. Something like that:
>
> [
> { codec = MJPEG, pointer to sublist by format for MJPEG },
> { codec = RAWVIDEO, idem },
> ]
>
> sublist = [
> { format = YUV420, pointer to sublist of frame sizes and rates },
> { format = YUV422, pointer to sublist of frame sizes and rates },
> ]
even more complex and still a subset of the existing
AVOptionRange(s) API
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140126/314afa59/attachment.asc>
More information about the ffmpeg-devel
mailing list