2014-03-28 23:33:35 +08:00
|
|
|
#ifndef GMIO_LIBSTL_FORMAT_H
|
|
|
|
#define GMIO_LIBSTL_FORMAT_H
|
|
|
|
|
|
|
|
#include "stl_global.h"
|
|
|
|
#include "../gmio_core/stream.h"
|
|
|
|
|
|
|
|
GMIO_C_LINKAGE_BEGIN
|
|
|
|
|
|
|
|
/*! This enums defines the various STL formats */
|
|
|
|
enum gmio_stl_format
|
|
|
|
{
|
|
|
|
GMIO_STL_ASCII_FORMAT, /*!< STL ASCII (text) */
|
|
|
|
GMIO_STL_BINARY_LE_FORMAT, /*!< STL binary (little-endian) */
|
|
|
|
GMIO_STL_BINARY_BE_FORMAT, /*!< STL binary (big-endian) */
|
|
|
|
GMIO_STL_UNKNOWN_FORMAT
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum gmio_stl_format gmio_stl_format_t;
|
|
|
|
|
2014-11-21 18:39:23 +08:00
|
|
|
/*! \brief Returns the format of the STL data in \p stream
|
|
|
|
*
|
2015-01-29 05:39:03 +08:00
|
|
|
* It will try to read 512 bytes from \p stream into a buffer and then
|
|
|
|
* analyses this data to guess the format.
|
2014-11-21 18:39:23 +08:00
|
|
|
*
|
2015-01-29 05:39:03 +08:00
|
|
|
* Parameter \p data_size must provide the total size (in bytes) of the
|
|
|
|
* stream data (e.g. file size), it is required to guess endianness in case
|
|
|
|
* of binary format.
|
2014-11-21 18:39:23 +08:00
|
|
|
*
|
|
|
|
* Returns GMIO_STL_UNKNOWN_FORMAT in case of error.
|
|
|
|
*/
|
2014-03-28 23:33:35 +08:00
|
|
|
GMIO_LIBSTL_EXPORT
|
|
|
|
gmio_stl_format_t gmio_stl_get_format(gmio_stream_t* stream, size_t data_size);
|
|
|
|
|
|
|
|
GMIO_C_LINKAGE_END
|
|
|
|
|
|
|
|
#endif /* GMIO_LIBSTL_FORMAT_H */
|