📄 player.h
字号:
#ifndef _PLAYER_H_
#define _PLAYER_H_
/*
* Copyright (C) 2003-2007 by egnite Software GmbH. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
* SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* For additional information see http://www.ethernut.de/
*/
/*!
* \file mp3player.h
* \brief MP3 Player.
*
* \verbatim
*
* $Log$
*
* \endverbatim
*/
#include <sys/socket.h>
#include <hxmp3/mp3dec.h>
#include <hxmp3/hermite.h>
#include "receiver.h"
#define PSTAT_IDLE 0
#define PSTAT_START 1
#define PSTAT_RUNNING 2
#define PSTAT_STOP 3
/*! \name Player Types */
/*@{*/
/*! \brief Player accepts MP3 encoded audio data. */
#define PLAYER_TYPE_MP3 1
/*@}*/
/*!
* \brief Player information structure type.
*/
typedef struct _PLAYERINFO PLAYERINFO;;
/*!
* \brief Player plug-in reference structure.
*
* A variable with this structure is provided by the plug-in.
*/
typedef struct _PLAYERPLUGIN {
int (*pp_create) (PLAYERINFO * pip);
int (*pp_setup) (PLAYERINFO * pip);
} PLAYERPLUGIN;
/*!
* \brief Player information structure.
*
* An instance of this structure is created when calling PlayerCreate().
*/
struct _PLAYERINFO {
/*! \brief Current status of the player.
*
* - \ref PSTAT_IDLE if stopped.
* - \ref PSTAT_START if currently starting.
* - \ref PSTAT_RUNNING if started.
* - \ref PSTAT_STOP if currently stopping.
*/
u_int pi_status;
/*! \brief Player plug-in command event queue.
*
* An event is posted to this queue whenever a status change is requested.
*/
HANDLE pi_cmdevt;
/*! \brief Player plug-in status event queue.
*
* An event is posted by the player plug-in to this queue whenever a
* status change took place.
*/
HANDLE pi_stsevt;
short pi_pcmbuf[MAX_NCHAN * MAX_NGRAN * MAX_NSAMP];
RECEIVERINFO *pi_rcvr;
/*! \brief Pointer to the plug-in reference structure.
*/
PLAYERPLUGIN *pi_ppp;
/*! \brief Player plug-in local data.
*
* Can be used by the player plug-in to store local data.
*/
void *pi_bcast;
};
__BEGIN_DECLS
/* Prototypes */
extern PLAYERINFO * PlayerCreate(PLAYERPLUGIN *ppp);
extern int PlayerStart(PLAYERINFO *pip, RECEIVERINFO *rip);
extern int PlayerStop(PLAYERINFO *pip);
extern u_int PlayerStatus(PLAYERINFO *pip);
__END_DECLS
/* End of prototypes */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -