00001 #ifndef __ANX_MEDIA_H__
00002 #define __ANX_MEDIA_H__
00003
00004 #include <annodex/anx_int64.h>
00005 #include <annodex/anx_types.h>
00006 #include <annodex/anx_core.h>
00007
00036 typedef struct _AnxMediaImporter AnxMediaImporter;
00037
00041 typedef struct _AnxMediaTrack AnxMediaTrack;
00042
00047 typedef struct _AnxMedia AnxMedia;
00048
00061 typedef AnxMedia * (*AnxMediaOpenFunc) (const char * path, const char * id,
00062 int ignore_media,
00063 double start_time, double end_time,
00064 AnxImportCallbacks * import_callbacks);
00065
00079 typedef AnxMedia * (*AnxMediaOpenFDFunc) (int fd, const char * id,
00080 int ignore_media,
00081 double start_time, double end_time,
00082 AnxImportCallbacks * import_callbacks);
00083
00091 typedef long (*AnxMediaReadFunc) (AnxMedia * media, unsigned char * buf,
00092 long n, long bound);
00093
00099 typedef long (*AnxMediaSizeofNextReadFunc) (AnxMedia * media, long bound);
00100
00105 typedef int (*AnxMediaCloseFunc) (AnxMedia * media);
00106
00107 struct _AnxMediaImporter {
00108 AnxMediaOpenFunc open;
00109 AnxMediaOpenFDFunc openfd;
00110 AnxMediaCloseFunc close;
00111 AnxMediaReadFunc read;
00112 AnxMediaSizeofNextReadFunc sizeof_next_read;
00113 char * content_type;
00114 };
00115
00116 struct _AnxMediaTrack {
00117 char * id;
00118 char * content_type;
00119 long nr_header_packets;
00120 anx_int64_t granule_rate_n;
00121 anx_int64_t granule_rate_d;
00122 anx_int64_t start_granule;
00123 anx_int64_t end_granule;
00124 anx_int64_t current_granule;
00125 int eos;
00126 };
00127
00128 struct _AnxMedia {
00129 AnxMediaImporter * importer;
00130 AnxList * tracks;
00131 AnxMediaTrack * current_track;
00132
00133
00134 int eos;
00135 double start_time;
00136 double end_time;
00137 void * custom_data;
00138 };
00139
00140 #ifdef __cplusplus
00141 extern "C" {
00142 #endif
00143
00149 int anx_register_media_importer (AnxMediaImporter * importer);
00150
00156 int anx_unregister_media_importer (AnxMediaImporter * importer);
00157
00158 #ifdef __cplusplus
00159 }
00160 #endif
00161
00162 #endif