2023-08-30 16:21:18 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2020-2023 ArtInChip Technology Co. Ltd
|
|
|
|
|
*
|
|
|
|
|
* author: <jun.ma@artinchip.com>
|
|
|
|
|
* Desc: aic_parser
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "aic_mov_parser.h"
|
|
|
|
|
#include "aic_raw_parser.h"
|
2023-11-30 19:48:02 +08:00
|
|
|
#include "aic_mp3_parser.h"
|
2024-04-03 16:40:57 +08:00
|
|
|
#include "aic_wav_parser.h"
|
2023-08-30 16:21:18 +08:00
|
|
|
|
|
|
|
|
s32 aic_parser_create(unsigned char *uri, struct aic_parser **parser)
|
|
|
|
|
{
|
|
|
|
|
char* ptr = NULL;
|
|
|
|
|
|
|
|
|
|
if (uri == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ptr = strrchr((char *)uri, '.');
|
|
|
|
|
if (ptr == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!strncmp(ptr+1, "mov", 3) || !strncmp(ptr+1, "mp4", 3)) {
|
|
|
|
|
return aic_mov_parser_create(uri, parser);
|
|
|
|
|
} else if (!strncmp(ptr+1, "264", 3)) {
|
|
|
|
|
return aic_raw_parser_create(uri, parser);
|
2023-11-30 19:48:02 +08:00
|
|
|
} else if (!strncmp(ptr+1, "mp3", 3)) {
|
|
|
|
|
return aic_mp3_parser_create(uri, parser);
|
2024-04-03 16:40:57 +08:00
|
|
|
} else if (!strncmp(ptr+1, "wav", 3)) {
|
|
|
|
|
return aic_wav_parser_create(uri, parser);
|
2023-08-30 16:21:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logw("unkown parser for (%s)", uri);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|