[FFmpeg-devel] [PATCH] Use v4l2 input format automatically if filename starts with "/dev/video"

Timothy Gu timothygu99 at gmail.com
Sat Oct 25 00:28:17 CEST 2014


On Fri, Oct 24, 2014 at 11:50 AM, Andrey Utkin
<andrey.krieger.utkin at gmail.com> wrote:
> 2014-10-24 20:34 GMT+04:00 Benoit Fouet <benoit.fouet at free.fr>:
>> Shouldn't this also test p->filename for non-NULLness?
>> LGTM otherwise.
>
> The code was copied from lavf/rtspdec.c
> There're places with same code.
> If this is really needed, then we should update it in other places.
>
> libavformat/sapdec.c:static int sap_probe(AVProbeData *p)
> libavformat/sapdec.c-{
> libavformat/sapdec.c-    if (av_strstart(p->filename, "sap:", NULL))
> libavformat/sapdec.c-        return AVPROBE_SCORE_MAX;
> libavformat/sapdec.c-    return 0;
> libavformat/sapdec.c-}
>
> libavformat/rtspdec.c:static int rtsp_probe(AVProbeData *p)
> libavformat/rtspdec.c-{
> libavformat/rtspdec.c-    if (
> libavformat/rtspdec.c-#if CONFIG_TLS_PROTOCOL
> libavformat/rtspdec.c-        av_strstart(p->filename, "rtsps:", NULL) ||
> libavformat/rtspdec.c-#endif
> libavformat/rtspdec.c-        av_strstart(p->filename, "rtsp:", NULL))
> libavformat/rtspdec.c-        return AVPROBE_SCORE_MAX;
> libavformat/rtspdec.c-    return 0;
> libavformat/rtspdec.c-}
>
> libavformat/rtsp.c:static int rtp_probe(AVProbeData *p)
> libavformat/rtsp.c-{
> libavformat/rtsp.c-    if (av_strstart(p->filename, "rtp:", NULL))
> libavformat/rtsp.c-        return AVPROBE_SCORE_MAX;
> libavformat/rtsp.c-    return 0;
> libavformat/rtsp.c-}

Those URLs are very explicit, while `/dev/` can mean anything,
including `/dev/stdin`.

Timothy


More information about the ffmpeg-devel mailing list