X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fkino%2Favi.cc;h=cc19bd5e1a000ca73deca8bf487fa3dfbd351bd9;hb=6f8293d53fc21742d9d43f94f0e590e1bfcb8ee0;hp=1ed29ad18c2ddf6b740ac20e510d47ceaa0a2504;hpb=815c458e95c73c39433fa7913afb4a830d7fd376;p=mlt diff --git a/src/modules/kino/avi.cc b/src/modules/kino/avi.cc index 1ed29ad1..cc19bd5e 100644 --- a/src/modules/kino/avi.cc +++ b/src/modules/kino/avi.cc @@ -15,124 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* -* Tag: $Name$ -* -* Change log: -* -* $Log$ -* Revision 1.1 2005/04/15 14:28:26 lilo_booter -* Initial version -* -* Revision 1.28 2005/04/01 23:43:10 ddennedy -* apply endian fixes from Daniel Kobras -* -* Revision 1.27 2004/10/11 01:37:11 ddennedy -* mutex safety locks in RIFF and AVI classes, type 2 AVI optimization, mencoder export script -* -* Revision 1.26 2004/01/05 03:43:11 ddennedy -* metadata editing, deinterlace options, bugfixes and cleanups -* -* Revision 1.25 2003/11/25 23:00:52 ddennedy -* cleanup and a few bugfixes -* -* Revision 1.24 2003/11/12 13:01:56 ddennedy -* disable JUNK chunks in MOVI list, FileHandler max file size zero = infinity -* -* Revision 1.23 2003/11/10 01:02:51 ddennedy -* bugfix: return error on AVI directory entries with size <0 -* -* Revision 1.22 2003/10/28 18:52:32 ddennedy -* fix prefs dialog crash, improve WAV import -* -* Revision 1.21 2003/10/21 16:34:32 ddennedy -* GNOME2 port phase 1: initial checkin -* -* Revision 1.19.2.9 2003/08/26 20:39:00 ddennedy -* relocate mutex unlock and add assert includes -* -* Revision 1.19.2.8 2003/07/24 14:13:57 ddennedy -* support for distinct audio stream in type2 AVI and Quicktime; support for more DV FOURCCs -* -* Revision 1.19.2.7 2003/06/10 23:53:35 ddennedy -* Daniel Kobras' WriteFrame error handling and automatic OpenDML, bugfixes in scene list updates, export AV/C Record -* -* Revision 1.19.2.6 2003/03/05 15:02:12 ddennedy -* yet anther AV/C bugfix, yet another AVI improvement -* -* Revision 1.19.2.5 2003/02/20 21:59:55 ddennedy -* bugfixes to capture and AVI -* -* Revision 1.19.2.4 2003/01/13 05:15:31 ddennedy -* added More Info panel and supporting methods -* -* Revision 1.19.2.3 2002/12/31 22:40:49 ddennedy -* bugfix recent versions Quicktime4Linux build options, extend dvsd fourcc check on AVI to the BITMAPINFOHEADER for compatibility with mencoder -* -* Revision 1.19.2.2 2002/11/25 04:48:30 ddennedy -* bugfix to report errors when loading files -* -* Revision 1.19.2.1 2002/11/24 23:36:55 ddennedy -* bugfix in AVI writing -* -* Revision 1.19 2002/10/08 12:08:01 ddennedy -* more sane frame count, greater potential compatibility -* -* Revision 1.18 2002/10/08 08:33:02 ddennedy -* fix number of frames for small dv2 -* -* Revision 1.17 2002/10/08 07:46:41 ddennedy -* AVI bugfixes, compatibility, optimization, warn bad file in capture and export dv file, allow no mplex -* -* Revision 1.15 2002/06/10 10:39:51 ddennedy -* minor fixes for large files -* -* Revision 1.14 2002/05/17 08:04:24 ddennedy -* revert const-ness of Frame references in Frame, FileHandler, and AVI classes -* -* Revision 1.13 2002/05/15 04:39:35 ddennedy -* bugfixes to dv2 AVI write, audio export, Xv init -* -* Revision 1.12 2002/04/29 05:09:21 ddennedy -* raw dv file support, Frame::ExtractAudio uses libdv, audioScrub prefs -* -* Revision 1.11 2002/04/15 19:12:32 schirmacher -* removed debugging code causing performance losses and crashes with dv2 files -* -* Revision 1.10 2002/04/09 06:53:42 ddennedy -* cleanup, new libdv 0.9.5, large AVI, dnd storyboard -* -* Revision 1.8 2002/03/25 21:34:25 arne -* Support for large (64 bit) files mostly completed -* -* Revision 1.7 2002/03/10 21:28:29 arne -* release 1.1b1, 64 bit support for type 1 avis -* -* Revision 1.6 2002/03/10 13:29:41 arne -* more changes for 64 bit access -* -* Revision 1.5 2002/03/09 17:59:28 arne -* moved index routines to AVIFile -* -* Revision 1.4 2002/03/09 10:26:26 arne -* improved constructors and assignment operator -* -* Revision 1.3 2002/03/09 08:55:57 arne -* moved a few variables to AVIFile -* -* Revision 1.2 2002/03/04 19:22:43 arne -* updated to latest Kino avi code -* -* Revision 1.1.1.1 2002/03/03 19:08:08 arne -* import of version 1.01 -* */ -#include "config.h" - // C++ includes -#include +#include #include #include @@ -149,6 +36,7 @@ using std::endl; #include #include #include +#include // local includes @@ -198,6 +86,9 @@ AVIFile::AVIFile() : RIFFFile(), } idx1 = new AVISimpleIndex; memset( idx1, 0, sizeof( AVISimpleIndex ) ); + memset( dmlh, 0, sizeof( dmlh ) ); + memset( &mainHdr, 0, sizeof( mainHdr ) ); + memset( &streamHdr, 0, sizeof( streamHdr ) ); } @@ -243,6 +134,9 @@ AVIFile::AVIFile( const AVIFile& avi ) : RIFFFile( avi ) isUpdateIdx1 = avi.isUpdateIdx1; + odml_list = 0; + dmlh_chunk = 0; + memset( &streamHdr, 0, sizeof( streamHdr ) ); } @@ -376,7 +270,7 @@ void AVIFile::Init( int format, int sampleFrequency, int indexType ) { indx[ i ] ->wLongsPerEntry = 4; indx[ i ] ->bIndexSubType = 0; - indx[ i ] ->bIndexType = AVI_INDEX_OF_INDEXES; + indx[ i ] ->bIndexType = KINO_AVI_INDEX_OF_INDEXES; indx[ i ] ->nEntriesInUse = 0; indx[ i ] ->dwReserved[ 0 ] = 0; indx[ i ] ->dwReserved[ 1 ] = 0; @@ -904,7 +798,7 @@ void AVIFile::ParseRIFF() avih_chunk = FindDirectoryEntry( make_fourcc( "avih" ) ); if ( avih_chunk != -1 ) - ReadChunk( avih_chunk, ( void* ) & mainHdr ); + ReadChunk( avih_chunk, ( void* ) & mainHdr, sizeof( MainAVIHeader ) ); } @@ -913,7 +807,7 @@ void AVIFile::ReadIndex() indx_chunk[ 0 ] = FindDirectoryEntry( make_fourcc( "indx" ) ); if ( indx_chunk[ 0 ] != -1 ) { - ReadChunk( indx_chunk[ 0 ], ( void* ) indx[ 0 ] ); + ReadChunk( indx_chunk[ 0 ], ( void* ) indx[ 0 ], sizeof( AVISuperIndex ) ); index_type = AVI_LARGE_INDEX; /* recalc number of frames from each index */ @@ -927,7 +821,7 @@ void AVIFile::ReadIndex() idx1_chunk = FindDirectoryEntry( make_fourcc( "idx1" ) ); if ( idx1_chunk != -1 ) { - ReadChunk( idx1_chunk, ( void* ) idx1 ); + ReadChunk( idx1_chunk, ( void* ) idx1, sizeof( AVISuperIndex ) ); idx1->nEntriesInUse = GetDirectoryEntry( idx1_chunk ).length / 16; index_type = AVI_SMALL_INDEX; @@ -983,7 +877,7 @@ void AVIFile::FlushIndx( int stream ) ix[ stream ] ->wLongsPerEntry = 2; ix[ stream ] ->bIndexSubType = 0; - ix[ stream ] ->bIndexType = AVI_INDEX_OF_CHUNKS; + ix[ stream ] ->bIndexType = KINO_AVI_INDEX_OF_CHUNKS; ix[ stream ] ->nEntriesInUse = 0; ix[ stream ] ->dwChunkId = indx[ stream ] ->dwChunkId; ix[ stream ] ->qwBaseOffset = offset + length; @@ -1062,14 +956,14 @@ bool AVIFile::verifyStreamFormat( FOURCC type ) while ( ( i = FindDirectoryEntry( strh, j++ ) ) != -1 ) { - ReadChunk( i, ( void* ) & avi_stream_header ); + ReadChunk( i, ( void* ) & avi_stream_header, sizeof( AVIStreamHeader ) ); if ( avi_stream_header.fccHandler == type ) return true; } j = 0; while ( ( i = FindDirectoryEntry( strf, j++ ) ) != -1 ) { - ReadChunk( i, ( void* ) & bih ); + ReadChunk( i, ( void* ) & bih, sizeof( BITMAPINFOHEADER ) ); if ( ( FOURCC ) bih.biCompression == type ) return true; } @@ -1085,7 +979,7 @@ bool AVIFile::verifyStream( FOURCC type ) while ( ( i = FindDirectoryEntry( strh, j++ ) ) != -1 ) { - ReadChunk( i, ( void* ) & avi_stream_header ); + ReadChunk( i, ( void* ) & avi_stream_header, sizeof( AVIStreamHeader ) ); if ( avi_stream_header.fccType == type ) return true; } @@ -1105,7 +999,9 @@ bool AVIFile::isOpenDML( void ) } AVI1File::AVI1File() : AVIFile() -{} +{ + memset( &dvinfo, 0, sizeof( dvinfo ) ); +} AVI1File::~AVI1File() @@ -1242,7 +1138,7 @@ void AVI1File::Init( int format, int sampleFrequency, int indexType ) several RIFF chunks of less than 1 GByte size. Old software however would only deal with the first RIFF chunk. - Note that the first entry (FILE) isn´t actually part + Note that the first entry (FILE) isn�t actually part of the AVI file. I use this (pseudo-) directory entry to keep track of the RIFF chunks and their positions in the AVI file. @@ -1779,7 +1675,7 @@ void AVIFile::setFccHandler( FOURCC type, FOURCC handler ) while ( ( k = FindDirectoryEntry( strf, j++ ) ) != -1 ) { - ReadChunk( k, ( void* ) & bih ); + ReadChunk( k, ( void* ) & bih, sizeof( BITMAPINFOHEADER ) ); bih.biCompression = handler; } } @@ -1796,7 +1692,7 @@ bool AVIFile::getStreamFormat( void* data, FOURCC type ) while ( ( result == false ) && ( i = FindDirectoryEntry( strh, j++ ) ) != -1 ) { - ReadChunk( i, ( void* ) & avi_stream_header ); + ReadChunk( i, ( void* ) & avi_stream_header, sizeof( AVIStreamHeader ) ); if ( avi_stream_header.fccType == type ) { FOURCC chunkID;