filenav.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 453 行 · 第 1/2 页

H
453
字号
/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : filenav.h /Project:AVOS  					** 
**        Revision : 1.0                                       	**
**		  Author:	LiChao                                      **
**                                                             	**
*****************************************************************/
#ifndef __FILENAV_H
#define __FILENAV_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "includes.h"
#include "ioapi.h"
#include "aw_windows.h"
#include "datasrc.h"
#define FILENAV_NEW
/**
 * @file filenav.h
 * @author LiChao, chao_li@amlogic.com.cn
 *
 * This is the head file of file/directory navigation manage program. It supply most useful
 * file/directory list navigation, and file copy, delete feature.
 *
*/
#define AV_FS_UNKNOWN       0
#define AV_FAT_FS			1
#define AV_ISO9660_FS		2
#define AV_DCF_FS			3
#define AV_UDF_FS			4
#define AV_NTSC_FS    		5
#define AV_CDFS_FS   		6
#define AV_NETFS_FS         7
#define AV_NTFS_FS   		8
#define AV_BTOPP_FS   		9
#define MOUNT_POINT_NAME_LEN 12
typedef struct {
	INT8U      mount_fs_type ;
    avfs_filesystem_options_t mount_fs_option;
	CHARSTR*   mount_device_name;   //Device path name, Like "/dev/disk/usba"
	CHARSTR*   mount_device_label;  //Volume Label
	CHARSTR*   mount_device_type;   //Device Type Str, Like"CF""MS"
	CHARSTR    mount_point_name[MOUNT_POINT_NAME_LEN] ; //mount point like: "/mnt/C"
}DEV_MOUNT_INFO;

#define SHORT_NAME_BUF_BYTES (NAME_MAX + 2)
#define LONG_NAME_BUF_BYTES  ((LNAME_MAX + 1)<<1)
typedef struct {
        int     index;
	int     long_name_bytes;
	int     short_name_bytes;
	char	short_name[SHORT_NAME_BUF_BYTES]; //add . and \0 
	char	long_name[LONG_NAME_BUF_BYTES]; 
}FILE_INFO;

/**
 * @brief Call this function to add new file system, so when a new device added, we can mount this file 
 * system to it.
 * @param [in] fs_ops file system operation table.
 * @param [in] fs_option File system option, like AVFS_FILESYSTEM_READ_WRITE, AVFS_FILESYSTEM_READ_ONLY
 * @param [in] fs_type Input the file system type defined before
 */                           
void FileNavRegisterMountFSType(avfs_filesystem_operations_table* fs_ops, avfs_filesystem_options_t fs_option, INT8U fs_type) ;


/**
 * file and dir operation routine.
 */
#define MAX_FILE_NUM_PER_DIR (1024*8)
#define MAX_EXTNAME_LEN 8


/* This define is not used for "short file name" only!*/
#define SHORT_NAME_LENGTH 	MAX_FILE_NAME_LENTH


typedef struct {
	INT32U		path_type ;
	INT16U		short_name_length;
	INT16U		long_name_length;
	CHARSTR		short_name[SHORT_NAME_LENGTH + 1];
	INT16U      index ;
	CHARSTR		*long_name;
} PATHNODE;

typedef struct _pathtree{
	struct _pathtree 	*parent ;
	struct _pathtree 	*children ;
	struct _pathtree 	*siblings ;
	struct _pathtree    *prev_siblings ;
	PATHNODE			path_info ;	
} PATHTREE, *PPATHTREE, PATHTREENODE;


enum file_nav_flags{
    SHOW_NON_ASIIC_NAME	=	0x0001,	//reserved   
    SHOW_LONG_FILE_NAME	=	0x0002,	//reserved
    SHOW_HIDDEN_FILES		=	0x0010,
    SHOW_HIDDEN_DIRS		=	0x0020,
    SHOW_SYSTEM_FILES		=	0x0040,
    SHOW_SYSTEM_DIRS		=	0x0080,
    SHOW_DIRECTORY			=	0x0100,
    SHOW_DOT_DIR			=	0x0200, 	//reserved
    SHOW_DOT_DOT_DIR		=	0x0400,	//reserved
    SHOW_ZERO_LENTH_FILE	=	0x1000,	//reserved
};

typedef struct filter_item_
{
    struct filter_item_* next;
    char* path;
    char* name;   
    INT32U type;
}filter_item_t;    

typedef struct _nav_filter{

        unsigned    show_dir:1;
        unsigned    show_hidden_file:1;
        unsigned    show_hidden_dir:1;
        unsigned    show_system_file:1;
        unsigned    show_system_dir:1;
        unsigned    show_long_file_name:1;
                
        unsigned    show_dot_dir:1;            //reserved
        unsigned    show_dot_dot_dir:1;     //reserved
        unsigned    show_non_asiic_name:1; //reserved
        unsigned    show_zero_length_file:1;    //reserved
        filter_item_t* filter_item_head;

}NAV_FILTER;

#define SHOW_NORMAL_FILES (SHOW_NON_ASIIC_NAME | \
                                                SHOW_LONG_FILE_NAME |\
                                                SHOW_DIRECTORY  )


/* out of date flags */
#define AUTO_FILTER_NON_ASIIC_NAME		0x00000001
#define AUTO_FILTER_ZERO_CHARACTER		0x00000002
#define SHOW_FILE_EXTEND_NAME			0x00000004
#define DYNAMIC_PARSER_FILE_SYSTEM		0x00000008

#define NAV_PATH_FLAG			0xFE000000
#define NAV_PATH_TYPE			0x01FFFFFF
#define NAV_IS_FILE				0x01FFFFFF
#define NAV_IS_DIR				0x80000000
#define NAV_PARENT_DONE			0x40000000
#define NAV_CHILD_DONE			0x20000000
#define NAV_CHILD_DOING			0x10000000
#define NAV_MORE_RIGHT_CHILD	0x08000000
#define NAV_MORE_LEFT_CHILD		0x04000000
#define MEDIA_UNKNOW			0x02000000


#define NAV_CHILD_PARSERED_FLAG		(NAV_CHILD_DONE | NAV_CHILD_DOING | NAV_MORE_RIGHT_CHILD | NAV_MORE_LEFT_CHILD)

#define MAX_FILTER_NUMBER 	50
#define MAX_FILTER_LENGTH 	256
#define ENABLE_MEDIA		0x80000000
#define MEDIA_FMT			0x7fffffff

typedef struct {
	INT32U		file_media_type[MAX_FILTER_NUMBER] ;
	INT8U		file_media_index[MAX_FILTER_LENGTH];
	CHARSTR 	filters[MAX_FILTER_LENGTH] ;
}FILTERPATTERN ;


#define FILE_NAV_SEMAPHORE_TIMEOUT		3000


#define       SEND_COPY_PROGRESS	1

typedef struct {
	INT32S      sur_file_id;
	INT32S      dst_file_id;
	char*       sour_file;
	char*       dest_file;
	INT32U      file_size;
	INT8U       flag ;
}FILECOPY_T;

typedef struct {
	CHARSTR    *file;
	INT16U      time ;
}FILEDEL_T;

typedef struct stat FILE_STAT;

/**
 * @brief Must Call this function before use file navigation API.
 * This function will malloc file list buffer, register known file type and initial other resource.
 * @param [in] lMaxParserFileNum Defined the max file list number, we'll malloc buffer size according
 * this, the size is lMaxParserFileNum * (sizeof(PATHTREE) + lMaxFileNameLength) .
 * @param [in] lFileNavBufferSize The malloc file list buffer size. If you want to give the file 
 * list buffer size instead of lMaxParserFileNum, you can set lMaxParserFileNum to 0 and give buffer size.
 * @param [in] lMaxFileNameLength The max long file name is 256, but we needn't so long name most time,
 * so you can input a resonable long name length to save more memory space.
 * @param [in] lFileNavFlag Defined file navigation action, we have following value:
          AUTO_FILTER_NON_ASIIC_NAME  if set this flag, all non asiic character will be deleted from file name.
          AUTO_FILTER_ZERO_CHARACTER  if set this flag, all zero character will be deleted from file name.
          SHOW_FILE_EXTEND_NAME       if not set this flag, file name's postfix will be deleted.
          DYNAMIC_PARSER_FILE_SYSTEM  if not set this flag, we'll search file list once and save first
                                      lMaxParserFileNum files to list and don't search other files any more.
 * @param [in] pFilterPattern Defined which type file will be added to file list, like "MP3;WMA;JPEG". 
 *         system can recognize following file types:
 *         "MP3;WMA;JPG;JPEG;JPE;VOB;BMP;TIF;TIFF;PNG;GIF;AVI;DIV;DIVX;DAT;MPEG;MPG;"
 *         you can call FileNavAddFilter to add new file type to system.
 * @return Return 0 if success or -1 for fail.
 */
INT32S InitialFileNavigation(INT32S lMaxParserFileNum, INT32S lFileNavBufferSize, INT32S lMaxFileNameLength,
                             INT32U lFileNavFlag, CHARSTR * pFilterPattern);
                             

/*query if the volume is writable*/

INT32S FileNavQueryVolumeWritable(const char *dir_name);

INT32U FileNavGetDiskNumberByTypeStr(char* typestr);

/**
 * @brief Retrun current directory path. 
 * @return Return dir path string.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?