From: John F. <jo...@us...> - 2010-01-12 17:19:06
|
Update of /cvsroot/ingex/ingex/libMXF/examples/archive/write In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11586 Modified Files: write_archive_mxf.c write_archive_mxf.h Log Message: Added (an optional) array of CRC-32s for each essence element to the archive mxf file's system item. Added reading of archive mxf file CRC-32 array. Index: write_archive_mxf.h =================================================================== RCS file: /cvsroot/ingex/ingex/libMXF/examples/archive/write/write_archive_mxf.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** write_archive_mxf.h 17 Dec 2009 16:19:00 -0000 1.4 --- write_archive_mxf.h 12 Jan 2010 17:18:48 -0000 1.5 *************** *** 43,58 **** /* create a new Archive MXF file and prepare for writing the essence */ int prepare_archive_mxf_file(const char* filename, int componentDepth8Bit, const mxfRational* aspectRatio, ! int numAudioTracks, int64_t startPosition, int beStrict, ArchiveMXFWriter** output); /* use the Archive MXF file (the filename is only used as metadata) and prepare for writing the essence */ /* note: if this function returns 0 then check whether *mxfFile is not NULL and needs to be closed */ int prepare_archive_mxf_file_2(MXFFile** mxfFile, const char* filename, int componentDepth8Bit, ! const mxfRational* aspectRatio, int numAudioTracks, int64_t startPosition, int beStrict, ArchiveMXFWriter** output); ! /* write the essence, in order, starting with the timecode, followed by video and then 0 or more audio */ ! int write_timecode(ArchiveMXFWriter* output, ArchiveTimecode vitc, ArchiveTimecode ltc); ! int write_video_frame(ArchiveMXFWriter* output, uint8_t* data, uint32_t size); ! int write_audio_frame(ArchiveMXFWriter* output, uint8_t* data, uint32_t size); /* close and delete the file and free output */ --- 43,60 ---- /* create a new Archive MXF file and prepare for writing the essence */ int prepare_archive_mxf_file(const char* filename, int componentDepth8Bit, const mxfRational* aspectRatio, ! int numAudioTracks, int includeCRC32, int64_t startPosition, int beStrict, ArchiveMXFWriter** output); /* use the Archive MXF file (the filename is only used as metadata) and prepare for writing the essence */ /* note: if this function returns 0 then check whether *mxfFile is not NULL and needs to be closed */ int prepare_archive_mxf_file_2(MXFFile** mxfFile, const char* filename, int componentDepth8Bit, ! const mxfRational* aspectRatio, int numAudioTracks, int includeCRC32, int64_t startPosition, int beStrict, ! ArchiveMXFWriter** output); ! /* write the essence, in order, starting with the system item, followed by video and then 0 or more audio */ ! int write_system_item(ArchiveMXFWriter* output, ArchiveTimecode vitc, ArchiveTimecode ltc, ! const uint32_t* crc32, int numCRC32); ! int write_video_frame(ArchiveMXFWriter* output, uint8_t* data, uint32_t size); ! int write_audio_frame(ArchiveMXFWriter* output, uint8_t* data, uint32_t size); /* close and delete the file and free output */ *************** *** 62,66 **** int complete_archive_mxf_file(ArchiveMXFWriter** output, InfaxData* sourceInfaxData, const PSEFailure* pseFailures, long numPSEFailures, ! const VTRError* vtrErrors, long numVTRErrors); int64_t get_archive_mxf_file_size(ArchiveMXFWriter* writer); --- 64,69 ---- int complete_archive_mxf_file(ArchiveMXFWriter** output, InfaxData* sourceInfaxData, const PSEFailure* pseFailures, long numPSEFailures, ! const VTRError* vtrErrors, long numVTRErrors, ! const DigiBetaDropout* digiBetaDropouts, long numDigiBetaDropouts); int64_t get_archive_mxf_file_size(ArchiveMXFWriter* writer); *************** *** 80,88 **** /* returns the content package (system, video + x audio elements) size */ ! int64_t get_archive_mxf_content_package_size(int componentDepth8Bit, int numAudioTracks); int parse_infax_data(const char* infaxDataString, InfaxData* infaxData, int beStrict); --- 83,92 ---- /* returns the content package (system, video + x audio elements) size */ ! int64_t get_archive_mxf_content_package_size(int componentDepth8Bit, int numAudioTracks, int includeCRC32); int parse_infax_data(const char* infaxDataString, InfaxData* infaxData, int beStrict); + uint32_t calc_crc32(uint8_t* data, uint32_t size); Index: write_archive_mxf.c =================================================================== RCS file: /cvsroot/ingex/ingex/libMXF/examples/archive/write/write_archive_mxf.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** write_archive_mxf.c 17 Dec 2009 16:19:00 -0000 1.8 --- write_archive_mxf.c 12 Jan 2010 17:18:48 -0000 1.9 *************** *** 34,38 **** ! /* declare the BBC D3 extensions */ #define MXF_LABEL(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) \ --- 34,38 ---- ! /* declare the BBC Archive extensions */ [...1574 lines suppressed...] + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d + }; + + uint32_t calc_crc32(uint8_t* data, uint32_t size) + { + uint32_t i; + uint32_t crc32 = 0; + + crc32 ^= 0xffffffff; + + for (i = 0; i < size; i++) + crc32 = g_crc32Table[(crc32 ^ data[i]) & 0xff] ^ (crc32 >> 8); + + return crc32 ^ 0xffffffff; + } + |