/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * 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.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT
 * HOLDER 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.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file u_fm_dlnafs.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *             This file contains public API for manipulating dlna devices.
 */
/*----------------------------------------------------------------------------*/
#ifndef _U_FM_DLNAFS_H_
#define _U_FM_DLNAFS_H_

#include "u_common.h"



/*!
 * @defgroup    groupMW_FM_DLNAFS DLNA File System
 * @ingroup     groupMW_FM
 * @brief    Provide extentional API about DLNA FS.
 * %dlna fs normally needn't access directly but from FM API. But dlna has some special
 * functions that can't be used from FM API, those functions is supplied specially here.
 *  
 * @see  groupMW_FM
 *
 * @{
 * */

/*! @enum DLNA_FILE_CONTENT_TYPE_T
 *  @brief dlna content type for filtering.
 *  @code
 *  typedef enum
 *  {
 *      DLNA_FILE_CONTENT_TYPE_CARELESS = -1,
 *      DLNA_FILE_CONTENT_TYPE_EXT_NAME = 0,
 *      DLNA_FILE_CONTENT_TYPE_DIR,
 *      DLNA_FILE_CONTENT_TYPE_FILE,
 *      DLNA_FILE_CONTENT_TYPE_IMAGE,
 *      DLNA_FILE_CONTENT_TYPE_IMAGE_PHOTO,
 *      DLNA_FILE_CONTENT_TYPE_AUDIO,
 *      DLNA_FILE_CONTENT_TYPE_AUDIO_MUSICTRACK,
 *      DLNA_FILE_CONTENT_TYPE_AUDIO_BROADCAST,
 *      DLNA_FILE_CONTENT_TYPE_AUDIO_BOOK,
 *      DLNA_FILE_CONTENT_TYPE_VIDEO,
 *      DLNA_FILE_CONTENT_TYPE_VIDEO_MOVIE,
 *      DLNA_FILE_CONTENT_TYPE_VIDEO_BROADCAST,
 *      DLNA_FILE_CONTENT_TYPE_VIDEO_MUSIC_VIDEOCLIP,
 *      DLNA_FILE_CONTENT_TYPE_PLAYLIST,
 *      DLNA_FILE_CONTENT_TYPE_TEXT,
 *      DLNA_FILE_CONTENT_TYPE_END
 *  } DLNA_FILE_CONTENT_TYPE_T;
 *  @endcode
 *  @li@c DLNA_FILE_CONTENT_TYPE_CARELESS      -  Don't set any filter specification.
 *  @li@c DLNA_FILE_CONTENT_TYPE_EXT_NAME      -  For filter extention name part which contains a specific sub-string.
 *  @li@c DLNA_FILE_CONTENT_TYPE_DIR           -  Filter dir.
 *  @li@c DLNA_FILE_CONTENT_TYPE_FILE          -  Filter file.
 *  @li@c DLNA_FILE_CONTENT_TYPE_IMAGE         -  Filter image.
 *  @li@c DLNA_FILE_CONTENT_TYPE_IMAGE_PHOTO         -  Filter image photo.
 *  @li@c DLNA_FILE_CONTENT_TYPE_AUDIO         -  Filter audio.
 *  @li@c DLNA_FILE_CONTENT_TYPE_AUDIO_BOOK    -  Filter audio book.
 *  @li@c DLNA_FILE_CONTENT_TYPE_AUDIO_MUSICTRACK    -  Filter audio musicTrack.
 *  @li@c DLNA_FILE_CONTENT_TYPE_AUDIO_BROADCAST    -  Filter audio broadcast.
 *  @li@c DLNA_FILE_CONTENT_TYPE_VIDEO         -  Filter video.
 */ 
typedef enum{
    DLNA_FILE_CONTENT_TYPE_CARELESS = -1,
    DLNA_FILE_CONTENT_TYPE_EXT_NAME = 0,
    DLNA_FILE_CONTENT_TYPE_DIR,
    DLNA_FILE_CONTENT_TYPE_FILE,
    DLNA_FILE_CONTENT_TYPE_IMAGE,
    DLNA_FILE_CONTENT_TYPE_IMAGE_PHOTO,
    DLNA_FILE_CONTENT_TYPE_AUDIO,
    DLNA_FILE_CONTENT_TYPE_AUDIO_MUSICTRACK,
    DLNA_FILE_CONTENT_TYPE_AUDIO_BROADCAST,
    DLNA_FILE_CONTENT_TYPE_AUDIO_BOOK,
    DLNA_FILE_CONTENT_TYPE_VIDEO,
    DLNA_FILE_CONTENT_TYPE_VIDEO_MOVIE,
    DLNA_FILE_CONTENT_TYPE_VIDEO_BROADCAST,
    DLNA_FILE_CONTENT_TYPE_VIDEO_MUSIC_VIDEOCLIP,
    DLNA_FILE_CONTENT_TYPE_PLAYLIST,
    DLNA_FILE_CONTENT_TYPE_TEXT,
    DLNA_FILE_CONTENT_TYPE_END
} DLNA_FILE_CONTENT_TYPE_T;

/*----------------------------------------------------------------------------------------------*/
/*! @enum DLNAR_T
 *  @brief Return code of dlnafs.
 *  @code
 *  typedef enum{
 *      DLNAR_OK = 0,
 *      DLNAR_DMS_CANNOT_SUPPORT = -1,
 *      DLNAR_INVAL = -2
 *  }DLNAR_T;
 *  @endcode
 *
 *  @li@c DLNAR_OK    - OK.
 *  @li@c DLNAR_DMS_CANNOT_SUPPORT    - DMS can't support.
 *  @li@c DLNAR_INVAL - Invalid arguments.
 */
typedef enum{
    DLNAR_OK = 0,
    DLNAR_DMS_CANNOT_SUPPORT = -1,
    DLNAR_INVAL = -2
}DLNAR_T;

/*----------------------------------------------------------------------------------------------*/
/*! @enum DLNA_ORDERBY_TYPE_T
 *  @brief Specify the orderby type.
 *  @code
 *  typedef enum{
 *      DLNA_ORDER_UNDEF = -1,      
 *      DLNA_ORDER_TITLE_ASCEND = 0,
 *      DLNA_ORDER_TITLE_DESCEND,   
 *      DLNA_ORDER_DATE_ASCEND,
 *      DLNA_ORDER_DATE_DESCEND,    
 *      DLNA_ORDER_RATE_ASCEND,
 *      DLNA_ORDER_RATE_DESCEND,    
 *      DLNA_ORDER_ARTIST_ASCEND,
 *      DLNA_ORDER_ARTIST_DESCEND,  
 *      DLNA_ORDER_GENRE_ASCEND,
 *      DLNA_ORDER_GENRE_DESCEND,   
 *      DLNA_ORDER_ALBUM_ASCEND,
 *      DLNA_ORDER_ALBUM_DESCEND,   
 *      DLNA_ORDER_SIZE_ASCEND,
 *      DLNA_ORDER_SIZE_DESCEND,    
 *  }DLNA_ORDERBY_TYPE_T;
 *  @endcode
 *  
 *  @li@c  DLNA_ORDER_UNDEF     - undefine.
 *  @li@c  DLNA_ORDER_TITLE_ASCEND   - In ascending order of title. 
 *  @li@c  DLNA_ORDER_TITLE_DESCEND  - In descending order of title. 
 *  @li@c  DLNA_ORDER_DATE_ASCEND    - Sort by date ascending.
 *  @li@c  DLNA_ORDER_DATE_DESCEND   - Sort by date descending.
 *  @li@c  DLNA_ORDER_RATE_ASCEND    - Sort by rate ascending.
 *  @li@c  DLNA_ORDER_RATE_DESCEND   - Sort by rate descending.
 *  @li@c  DLNA_ORDER_ARTIST_ASCEND  - Sort by artist ascending.
 *  @li@c  DLNA_ORDER_ARTIST_DESCEND - Sort by artist descending.
 *  @li@c  DLNA_ORDER_GENRE_ASCEND   - Sort by genri ascending.
 *  @li@c  DLNA_ORDER_GENRE_DESCEND  - Sort by genri descending.
 *  @li@c  DLNA_ORDER_ALBUM_ASCEND   - Sort by album ascending.
 *  @li@c  DLNA_ORDER_ALBUM_DESCEND  - Sort by album descending.
 *  @li@c  DLNA_ORDER_SIZE_ASCEND    - Sort by size ascending.
 *  @li@c  DLNA_ORDER_SIZE_DESCEND   - Sort by size descending.
 */
typedef enum{
    DLNA_ORDER_UNDEF = -1,      /* undefine. */
    DLNA_ORDER_TITLE_ASCEND = 0,         /* In ascending order of title. */
    DLNA_ORDER_TITLE_DESCEND,        /* In descending order of title. */
    DLNA_ORDER_DATE_ASCEND,
    DLNA_ORDER_DATE_DESCEND,         /* sort by date. */
    DLNA_ORDER_RATE_ASCEND,
    DLNA_ORDER_RATE_DESCEND,         /* sort by rate. */
    DLNA_ORDER_ARTIST_ASCEND,
    DLNA_ORDER_ARTIST_DESCEND,       /* sort by artist */
    DLNA_ORDER_GENRE_ASCEND,
    DLNA_ORDER_GENRE_DESCEND,        /* sort by genre */
    DLNA_ORDER_ALBUM_ASCEND,
    DLNA_ORDER_ALBUM_DESCEND,        /* sort by album */
    DLNA_ORDER_SIZE_ASCEND,
    DLNA_ORDER_SIZE_DESCEND,         /* sort by file size. */
}DLNA_ORDERBY_TYPE_T;

typedef enum
{
    DLNAFS_SEEK_UNKNOWN = 0,
    DLNAFS_SEEK_NONSUPPORTED,
    DLNAFS_SEEK_BYTE_ONLY,
    DLNAFS_SEEK_TIME_ONLY,
    DLNAFS_SEEK_BYTE_AND_TIME,
    DLNAFS_SEEK_RESEREVED
} DLNAFS_SEEK_CAP_T;

/*----------------------------------------------------------------------------------------------*/
/*! @struct DLNA_MEDIA_INFO_T
 *  @brief This struct supplies the fields used by LPCM playing.
 *  @code
 *  typedef struct _DLNA_MEDIA_INFO_T
 *  {
 *      UINT64                      ui8_size;
 *      UINT32                      ui4_sampling_frequency;
 *      UINT16                      ui2_bits_per_sample;
 *      UINT16                      ui2_channels;
 *      UINT32                      ui4_bitrate;
 *      UINT32                      ui4_resolution;
 *      UINT16                      ui4_colorDepth;         
 *  } DLNA_MEDIA_INFO_T;
 *  @endcode
 *  @li@c      ui8_size;               -  File size
 *  @li@c      ui4_sampling_frequency; -  sampling frequency
 *  @li@c      ui2_bits_per_sample;    -  bits per sample
 *  @li@c      ui2_channels;           -  channels number
 *  @li@c      ui4_bitrate;            -  bit rate
 *  @li@c      ui4_resolution;         -  resolution of the content
 *  @li@c      ui4_colorDepth;         -  color depth of the content
*/
typedef struct _DLNA_MEDIA_INFO_T
{
    
    /* common */
    UINT64                      ui8_size;
    /* size */
    CHAR                        date[64];
	/* date*/

    /* audio */
    UINT32                      ui4_sampling_frequency;
    /* sampleFrequency */
    UINT16                      ui2_bits_per_sample;
    
    UINT16                      ui2_channels;
    /* nrAudioChannels */
    UINT32                      ui4_bitrate;
    /* bitrate */

    /* image */
    UINT32                      ui4_resolution;
    /* resolution */
    UINT16                      ui4_colorDepth;
    /* colorDepth */

    /* duration*/
    /* CHAR                        duration[64];*/
    UINT64                      ui8_duration;
} DLNA_MEDIA_INFO_T;


/*! @}  */
#endif /* _U_FM_DLNAFS_H_ */
