[FFmpeg-devel] NC camera patch
nicolas martin
elvadrias
Sat Jan 10 00:10:07 CET 2009
> nicolas martin wrote:
>
>> Hi all,
>>
>> I finally made some code to read the camera feed sent by NC46** types
>> cameras.
>>
>> Thanks for reading and sharing your thoughts !
>
> The format looks quite simple and your code quite complicated.
> Maybe I missed some subtlety in the format.
> So let me first describe the format as I understand it:
> Each frame is composed of:
> - A header (16 bytes)
> * 4 bytes : a flag (eg: 0x1A5 (big-endian))
> * 1 byte : unknown/unused
> * 2 bytes : data_size (only when flag == 0x1A5)
> * 9 bytes : unknown/unused
> - MPEG4 data frame (data_size bytes)
> Please correct me if there's something wrong here.
Yeah, that's it !
>
>
> If my description is right, you could write your frame reader
> function trivially, with something like that:
>
> flag = get_be32(pb);
> get_byte(pb);
> size = get_le16(pb);
> url_fskip(pb, 9);
> if (flag != 0x1A5)
> /* error handling */;
> av_new_packet(pkt, size)
> get_buffer(pb, pkt->data, size);
>
> You need some more error checking, etc...
> But basically, this code should be enough.
Well you definitely have it ...
I didn't read a lot of code in ffmpeg, and so I thought I had to use
get_partial_buffer at any cost.
Once you know, you can read as many bytes as you need, then definitely
this code is way much simpler.
>
>
> BTW: you should upload a sample file like described in [1] to allow
> other developers to test your code.
I will do it !
> Oh, and your nc_read_header() seems to contain code which is
> totally unrelated to your format (MJPEG, DIRAC, etc...).
> And you don't need to use s->iformat->value if it's hardcoded
> to MPEG4.
I really don't know what to put there.
In fact, I copied a chunk of code, I found in raw.c.
The only thing I needed was to initialize my structure, that seems
quite useless now !
So what should I put in it, now that I don't have to use a structure
anymore ?
>
>
> Aurel
>
> [1] http://ffmpeg.org/bugreports.html
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list