• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/amlogic/media/stream_input/amports/amstream_profile.c
3  *
4  * Copyright (C) 2016 Amlogic, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #include <linux/kernel.h>
19 #include <linux/fs.h>
20 #include <linux/device.h>
21 #include <linux/interrupt.h>
22 #include <linux/amlogic/media/utils/amstream.h>
23 
24 static const struct codec_profile_t *vcodec_profile[SUPPORT_VDEC_NUM] = { 0 };
25 
26 static int vcodec_profile_idx;
27 
vcodec_profile_read(char * buf)28 ssize_t vcodec_profile_read(char *buf)
29 {
30 	char *pbuf = buf;
31 	int i = 0;
32 
33 	for (i = 0; i < vcodec_profile_idx; i++) {
34 		pbuf += snprintf(pbuf, PAGE_SIZE - (pbuf - buf), "%s:%s;\n", vcodec_profile[i]->name,
35 						vcodec_profile[i]->profile);
36 	}
37 
38 	return pbuf - buf;
39 }
40 EXPORT_SYMBOL(vcodec_profile_read);
41 
vcodec_profile_register(const struct codec_profile_t * vdec_profile)42 int vcodec_profile_register(const struct codec_profile_t *vdec_profile)
43 {
44 	if (vcodec_profile_idx < SUPPORT_VDEC_NUM) {
45 		vcodec_profile[vcodec_profile_idx] = vdec_profile;
46 		vcodec_profile_idx++;
47 		pr_debug("regist %s codec profile\n", vdec_profile->name);
48 
49 	}
50 
51 	return 0;
52 }
53 EXPORT_SYMBOL(vcodec_profile_register);
54 
is_support_profile(char * name)55 bool is_support_profile(char *name)
56 {
57 	int ret = 0;
58 	int i, size = ARRAY_SIZE(vcodec_profile);
59 
60 	for (i = 0; i < size; i++) {
61 		if (!vcodec_profile[i])
62 			break;
63 		if (!strcmp(name, vcodec_profile[i]->name))
64 			return true;
65 	}
66 	return ret;
67 }
68 EXPORT_SYMBOL(is_support_profile);
69 
70 
71