Blame ports/MSVC++/2008clr/mpg123clr/error.h

Packit c32a2d
/*
Packit c32a2d
	mpg123clr: MPEG Audio Decoder library Common Language Runtime version.
Packit c32a2d

Packit c32a2d
	copyright 2009 by Malcolm Boczek - free software under the terms of the LGPL 2.1
Packit c32a2d
	mpg123clr.dll is a derivative work of libmpg123 - all original mpg123 licensing terms apply.
Packit c32a2d

Packit c32a2d
	All rights to this work freely assigned to the mpg123 project.
Packit c32a2d
*/
Packit c32a2d
/*
Packit c32a2d
	libmpg123: MPEG Audio Decoder library
Packit c32a2d

Packit c32a2d
	copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
Packit c32a2d
	see COPYING and AUTHORS files in distribution or http://mpg123.org
Packit c32a2d

Packit c32a2d
*/
Packit c32a2d
/*
Packit c32a2d
	1.8.1.0	04-Aug-09	Initial release.
Packit c32a2d
	1.9.0.0 24-Sep-09	Function names harmonized with libmpg123 (mb)
Packit c32a2d
	1.12.0.0 14-Apr-10	Revision harmonization (catch-up)
Packit c32a2d
*/
Packit c32a2d

Packit c32a2d
#pragma once
Packit c32a2d

Packit c32a2d
#pragma warning(disable : 4635)
Packit c32a2d
#include "mpg123.h"
Packit c32a2d
#pragma warning(default : 4635)
Packit c32a2d

Packit c32a2d
#include "enum.h"
Packit c32a2d

Packit c32a2d
using namespace System;
Packit c32a2d

Packit c32a2d
namespace mpg123clr
Packit c32a2d
{
Packit c32a2d
	// defgroup mpg123_error mpg123 error handling
Packit c32a2d
	//
Packit c32a2d
	// Functions to get text version of the error numbers and an enumeration
Packit c32a2d
	// of the error codes returned by libmpg123.
Packit c32a2d
	//
Packit c32a2d
	// Most functions operating on a mpg123_handle simply return MPG123_OK on success and MPG123_ERR on failure (setting the internal error variable of the handle to the specific error code).
Packit c32a2d
	// Decoding/seek functions may also return message codes MPG123_DONE, MPG123_NEW_FORMAT and MPG123_NEED_MORE (please read up on these on how to react!).
Packit c32a2d
	// The positive range of return values is used for "useful" values when appropriate.
Packit c32a2d
	//
Packit c32a2d
	//
Packit c32a2d
	//
Packit c32a2d

Packit c32a2d

Packit c32a2d
	namespace mpg
Packit c32a2d
	{
Packit c32a2d
		///<summary>Enumeration of the message and error codes as returned by libmpg123 functions.</summary>
Packit c32a2d
		public enum class ErrorCode
Packit c32a2d
		{
Packit c32a2d
			done = MPG123_DONE,								/// Message: Track ended. 
Packit c32a2d
			new_format = MPG123_NEW_FORMAT,					/// Message: Output format will be different on next call. 
Packit c32a2d
			need_more = MPG123_NEED_MORE,					/// Message: For feed reader: "Feed me more!" 
Packit c32a2d
			err = MPG123_ERR,								/// Generic Error 
Packit c32a2d
			ok = MPG123_OK,									/// Success 
Packit c32a2d
			bad_outformat = MPG123_BAD_OUTFORMAT,			/// Unable to set up output format! 
Packit c32a2d
			bad_channel = MPG123_BAD_CHANNEL,				/// Invalid channel number specified. 
Packit c32a2d
			bad_rate = MPG123_BAD_RATE,						/// Invalid sample rate specified.  
Packit c32a2d
			err_16to8table = MPG123_ERR_16TO8TABLE,			/// Unable to allocate memory for 16 to 8 converter table! 
Packit c32a2d
			bad_param = MPG123_BAD_PARAM,					/// Bad parameter id! 
Packit c32a2d
			bad_buffer = MPG123_BAD_BUFFER,					/// Bad buffer given -- invalid pointer or too small size. 
Packit c32a2d
			out_of_mem = MPG123_OUT_OF_MEM,					/// Out of memory -- some malloc() failed. 
Packit c32a2d
			not_initialized = MPG123_NOT_INITIALIZED,		/// You didn't initialize the library! 
Packit c32a2d
			bad_decoder = MPG123_BAD_DECODER,				/// Invalid decoder choice. 
Packit c32a2d
			bad_handle = MPG123_BAD_HANDLE,					/// Invalid mpg123 handle. 
Packit c32a2d
			no_buffers = MPG123_NO_BUFFERS,					/// Unable to initialize frame buffers (out of memory?). 
Packit c32a2d
			bad_rva = MPG123_BAD_RVA,						/// Invalid RVA mode. 
Packit c32a2d
			no_gapless = MPG123_NO_GAPLESS,					/// This build doesn't support gapless decoding. 
Packit c32a2d
			no_space = MPG123_NO_SPACE,						/// Not enough buffer space. 
Packit c32a2d
			bad_types = MPG123_BAD_TYPES,					/// Incompatible numeric data types. 
Packit c32a2d
			bad_band = MPG123_BAD_BAND,						/// Bad equalizer band. 
Packit c32a2d
			err_null = MPG123_ERR_NULL,						/// Null pointer given where valid storage address needed. 
Packit c32a2d
			err_reader = MPG123_ERR_READER,					/// Error reading the stream. 
Packit c32a2d
			no_seek_from_end = MPG123_NO_SEEK_FROM_END,		/// Cannot seek from end (end is not known).
Packit c32a2d
			bad_whence = MPG123_BAD_WHENCE,					/// Invalid 'whence' for seek function.
Packit c32a2d
			no_timeout = MPG123_NO_TIMEOUT,					/// Build does not support stream timeouts. 
Packit c32a2d
			bad_file = MPG123_BAD_FILE,						/// File access error. 
Packit c32a2d
			no_seek = MPG123_NO_SEEK,						/// Seek not supported by stream. 
Packit c32a2d
			no_reader = MPG123_NO_READER,					/// No stream opened. 
Packit c32a2d
			bad_pars = MPG123_BAD_PARS,						/// Bad parameter handle. 
Packit c32a2d
			bad_index_par = MPG123_BAD_INDEX_PAR,			/// Bad parameters to mpg123_index() 
Packit c32a2d
			out_of_sync = MPG123_OUT_OF_SYNC,				/// Lost track in bytestream and did not try to resync. 
Packit c32a2d
			resync_fail = MPG123_RESYNC_FAIL,				/// Resync failed to find valid MPEG data. 
Packit c32a2d
			no_8bit = MPG123_NO_8BIT,						/// No 8bit encoding possible. 
Packit c32a2d
			bad_align = MPG123_BAD_ALIGN,					/// Stack aligmnent error 
Packit c32a2d
			null_buffer = MPG123_NULL_BUFFER,				/// NULL input buffer with non-zero size... 
Packit c32a2d
			no_relseek = MPG123_NO_RELSEEK,					/// Relative seek not possible (screwed up file offset) 
Packit c32a2d
			null_pointer = MPG123_NULL_POINTER,				/// You gave a null pointer somewhere where you shouldn't have. 
Packit c32a2d
			bad_key = MPG123_BAD_KEY,						/// Bad key value given. 
Packit c32a2d
			no_index = MPG123_NO_INDEX,						/// No frame index in this build. 
Packit c32a2d
			index_fail = MPG123_INDEX_FAIL,					/// Something with frame index went wrong. 
Packit c32a2d
			bad_decoder_setup = MPG123_BAD_DECODER_SETUP,	/// Something prevents a proper decoder setup 
Packit c32a2d
			missing_feature = MPG123_MISSING_FEATURE,		/// This feature has not been built into libmpg123. 
Packit c32a2d
			/* 1.8.1 */
Packit c32a2d
			bad_value = MPG123_BAD_VALUE,					/// A bad value has been given, somewhere. 
Packit c32a2d
			lseek_failed = MPG123_LSEEK_FAILED,				/// Low-level seek failed.
Packit c32a2d
			/* 1.12.0 */
Packit c32a2d
			bad_custom_io = MPG123_BAD_CUSTOM_IO,			/// Custom I/O not prepared.
Packit c32a2d
			lfs_overflow = MPG123_LFS_OVERFLOW,				/// Offset value overflow during translation of large file API calls,
Packit c32a2d
															/// - your client program cannot handle that large file.
Packit c32a2d

Packit c32a2d
		};
Packit c32a2d
	}
Packit c32a2d

Packit c32a2d
	///<summary>Wrapper for mpg123_errors</summary>
Packit c32a2d
	public ref class mpg123error
Packit c32a2d
	{
Packit c32a2d
	protected:
Packit c32a2d
		///<summary>Finalizer.
Packit c32a2d
		///<para>Cleanly handles mpg123_delete of internal (unmanaged) handles.</para></summary>
Packit c32a2d
		/// Implementation of CLR Finalize().
Packit c32a2d
		!mpg123error(void);
Packit c32a2d

Packit c32a2d
	public:
Packit c32a2d
		///<summary>Constructor.</summary>
Packit c32a2d
		mpg123error(void);
Packit c32a2d

Packit c32a2d
		///<summary>Destructor. Used for final object deletion.
Packit c32a2d
		///<para>Calls finalizer for clean disposal of internal (unmanaged) library handles.</para>
Packit c32a2d
		///</summary>
Packit c32a2d
		/// Implementation of CLR Dispose().
Packit c32a2d
		/// ~Destructor and !Finalizer are the prescribed implementation of Dispose() and Finalize().
Packit c32a2d
		/// See Destructors and Finalizers in Visual C++
Packit c32a2d
		~mpg123error(void);
Packit c32a2d

Packit c32a2d
		///<summary>Obtain a string description of the errcode meaning.
Packit c32a2d
		///<para>Returns a String description representing the error code.</para>
Packit c32a2d
		///</summary>
Packit c32a2d
		///<param name="errcode">The error code to be described.</param>
Packit c32a2d
		///<returns>Returns a String description representing the error code.</returns>
Packit c32a2d
		static String^ __clrcall mpg123_plain_strerror(mpg123clr::mpg::ErrorCode errcode);
Packit c32a2d
	};
Packit c32a2d
}