[FFmpeg-devel] [PATCH v3] lavf/h264: add support for h264 video from Arecont camera, fixes ticket #5154
Shivam Goyal
shivgo at iitk.ac.in
Thu May 9 04:58:20 EEST 2019
On 09-05-2019 02:16, Michael Niedermayer wrote:
> 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
I have tested this on the file attached to the ticket, the error didn't
came. Please, could you tell me how to solve this error and why it came.
Thanks for the review
Shivam Goyal
More information about the ffmpeg-devel
mailing list