[FFmpeg-devel] NC camera patch
Fri Jan 9 23:59:57 CET 2009
nicolas martin wrote:
> Hi all,
> I finally made some code to read the camera feed sent by NC46** types
> 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.
If my description is right, you could write your frame reader
function trivially, with something like that:
flag = get_be32(pb);
size = get_le16(pb);
if (flag != 0x1A5)
/* error handling */;
get_buffer(pb, pkt->data, size);
You need some more error checking, etc...
But basically, this code should be enough.
BTW: you should upload a sample file like described in  to allow
other developers to test your code.
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
More information about the ffmpeg-devel