[FFmpeg-devel] [PATCH v3] lavf/h264: add support for h264 video from Arecont camera, fixes ticket #5154
Michael Niedermayer
michael at niedermayer.cc
Wed May 8 23:46:03 EEST 2019
On Tue, May 07, 2019 at 10:05:12AM +0530, Shivam Goyal wrote:
> The patch is for ticket #5154.
>
> I have improved the patch as suggested.
>
> Please review.
>
> Thank you,
>
> Shivam Goyal
> Changelog | 1
> libavformat/Makefile | 1
> libavformat/allformats.c | 1
> libavformat/h264dec.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++
> libavformat/version.h | 4 -
> 5 files changed, 126 insertions(+), 2 deletions(-)
> 34932cf36d17537b8fc34642e92cc1fff6ad481e add_arecont_h264_support_v3.patch
> From 2aa843626f939218179d3ec252f76f9991c33ed6 Mon Sep 17 00:00:00 2001
> From: Shivam Goyal <shivamgoyal1506 at outlook.com>
> Date: Tue, 7 May 2019 10:01:15 +0530
> Subject: [PATCH] lavf/h264: Add support for h264 video from Arecont camera,
> fixes ticket #5154
[...]
> @@ -117,4 +120,122 @@ static int h264_probe(const AVProbeData *p)
> return 0;
> }
>
> +static int arecont_h264_probe(const AVProbeData *p)
> +{
> + int i, j, k, o = 0;
> + int ret = h264_probe(p);
> + const uint8_t id[] = {0x2D, 0x2D, 0x66, 0x62, 0x64, 0x72, 0x0D, 0x0A};
> +
> + if (!ret)
> + return 0;
> + for (i = 0; i + 7 < p->buf_size; i++){
> + if (p->buf[i] == id[0] && !memcmp(id, p->buf + i, 8))
> + o++;
> + }
> + if (o >= 1)
> + return ret + 1;
> + return 0;
> +}
> +
> +static int read_raw_arecont_h264_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> + int ret, size, start, end, new_size = 0, i, j, k, w = 0;
> + const uint8_t id[] = {0x2D, 0x2D, 0x66, 0x62, 0x64, 0x72};
> + uint8_t *data;
> + int64_t pos;
> +
> + //Extra to find the http header
> + size = 2 * ARECONT_H264_MIME_SIZE + RAW_PACKET_SIZE;
> + data = av_malloc(size);
> +
> + if (av_new_packet(pkt, size) < 0)
> + return AVERROR(ENOMEM);
memleak on error
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190508/2e0b0d48/attachment.sig>
More information about the ffmpeg-devel
mailing list