]> git.sesse.net Git - mlt/blobdiff - src/modules/kino/riff.cc
Enable build on NetBSD (3090684)
[mlt] / src / modules / kino / riff.cc
index bc616dda02cd972d2f0185b8188581b6eb516696..efd91d61c0967710d1a4f952786b0429719a5782 100644 (file)
 * 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.18  2005/04/01 23:43:10  ddennedy
-* apply endian fixes from Daniel Kobras
-*
-* Revision 1.17  2004/10/11 01:37:11  ddennedy
-* mutex safety locks in RIFF and AVI classes, type 2 AVI optimization, mencoder export script
-*
-* Revision 1.16  2003/11/25 23:01:24  ddennedy
-* cleanup and a few bugfixes
-*
-* Revision 1.15  2003/10/21 16:34:34  ddennedy
-* GNOME2 port phase 1: initial checkin
-*
-* Revision 1.13.2.3  2003/08/26 20:39:00  ddennedy
-* relocate mutex unlock and add assert includes
-*
-* Revision 1.13.2.2  2003/01/28 12:54:13  lilo_booter
-* New 'no change' image transition
-*
-* Revision 1.13.2.1  2002/11/25 04:48:31  ddennedy
-* bugfix to report errors when loading files
-*
-* Revision 1.13  2002/09/13 06:49:49  ddennedy
-* build update, cleanup, bugfixes
-*
-* Revision 1.12  2002/04/21 06:36:40  ddennedy
-* kindler avc and 1394 bus reset support in catpure page, honor max file size
-*
-* Revision 1.11  2002/04/09 06:53:42  ddennedy
-* cleanup, new libdv 0.9.5, large AVI, dnd storyboard
-*
-* Revision 1.4  2002/03/25 21:34:25  arne
-* Support for large (64 bit) files mostly completed
-*
-* Revision 1.3  2002/03/10 21:28:29  arne
-* release 1.1b1, 64 bit support for type 1 avis
-*
-* 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"
@@ -76,7 +25,6 @@
 //#include <stdio.h>
 #include <iostream>
 #include <iomanip>
-#include <byteswap.h>
 
 using std::cout;
 using std::hex;
@@ -107,7 +55,7 @@ using std::endl;
     could not get it working on the gcc compiler so I had to use this
     workaround. We can now use id = make_fourcc("ABCD") instead. */
 
-FOURCC make_fourcc( char *s )
+FOURCC make_fourcc( const char *s )
 {
        if ( s[ 0 ] == 0 )
                return 0;
@@ -507,10 +455,10 @@ void RIFFFile::ParseChunk( int parent )
 
        /* Check whether it is a LIST. If so, let ParseList deal with it */
 
-       read( fd, &type, sizeof( type ) );
+       fail_if( read( fd, &type, sizeof( type ) ) != sizeof( type ));
        if ( type == make_fourcc( "LIST" ) )
        {
-               typesize = -sizeof( type );
+               typesize = (int) -sizeof( type );
                fail_if( lseek( fd, typesize, SEEK_CUR ) == ( off_t ) - 1 );
                ParseList( parent );
        }
@@ -612,14 +560,14 @@ void RIFFFile::ParseRIFF( void )
  
 */
 
-void RIFFFile::ReadChunk( int chunk_index, void *data )
+void RIFFFile::ReadChunk( int chunk_index, void *data, off_t data_len )
 {
        RIFFDirEntry entry;
 
        entry = GetDirectoryEntry( chunk_index );
        pthread_mutex_lock( &file_mutex );
        fail_if( lseek( fd, entry.offset, SEEK_SET ) == ( off_t ) - 1 );
-       fail_neg( read( fd, data, entry.length ) );
+       fail_neg( read( fd, data, entry.length > data_len ? data_len : entry.length ) );
        pthread_mutex_unlock( &file_mutex );
 }