Lines Matching +full:video +full:- +full:codec

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * VIDEO MOTION CODECs internal API for video devices
5 * Interface for MJPEG (and maybe later MPEG/WAVELETS) codec's
20 struct videocodec *codec; member
25 const struct videocodec *codec; member
42 struct videocodec *codec; in videocodec_attach() local
53 master->name, master->flags, master->magic); in videocodec_attach()
63 if ((master->flags & h->codec->flags) == master->flags) { in videocodec_attach()
64 zrdev_dbg(zr, "%s: try '%s'\n", __func__, h->codec->name); in videocodec_attach()
66 codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); in videocodec_attach()
67 if (!codec) in videocodec_attach()
70 res = strlen(codec->name); in videocodec_attach()
71 snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached); in videocodec_attach()
72 codec->master_data = master; in videocodec_attach()
73 res = codec->setup(codec); in videocodec_attach()
75 zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name); in videocodec_attach()
79 ptr->codec = codec; in videocodec_attach()
81 a = h->list; in videocodec_attach()
83 h->list = ptr; in videocodec_attach()
86 while (a->next) in videocodec_attach()
87 a = a->next; // find end in videocodec_attach()
88 a->next = ptr; in videocodec_attach()
90 h->codec->name); in videocodec_attach()
93 h->attached += 1; in videocodec_attach()
94 return codec; in videocodec_attach()
96 kfree(codec); in videocodec_attach()
98 h = h->next; in videocodec_attach()
101 zrdev_err(zr, "%s: no codec found!\n", __func__); in videocodec_attach()
105 kfree(codec); in videocodec_attach()
109 int videocodec_detach(struct videocodec *codec) in videocodec_detach() argument
116 if (!codec) { in videocodec_detach()
118 return -EINVAL; in videocodec_detach()
121 zr = videocodec_to_zoran(codec); in videocodec_detach()
124 codec->name, codec->type, codec->flags, codec->magic); in videocodec_detach()
128 return -ENXIO; in videocodec_detach()
132 a = h->list; in videocodec_detach()
135 if (codec == a->codec) { in videocodec_detach()
136 res = a->codec->unset(a->codec); in videocodec_detach()
139 a->codec->name); in videocodec_detach()
140 a->codec->master_data = NULL; in videocodec_detach()
142 zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); in videocodec_detach()
143 a->codec->master_data = NULL; in videocodec_detach()
146 h->list = a->next; in videocodec_detach()
149 prev->next = a->next; in videocodec_detach()
152 kfree(a->codec); in videocodec_detach()
154 h->attached -= 1; in videocodec_detach()
158 a = a->next; in videocodec_detach()
160 h = h->next; in videocodec_detach()
163 zrdev_err(zr, "%s: given codec not found!\n", __func__); in videocodec_detach()
164 return -EINVAL; in videocodec_detach()
167 int videocodec_register(const struct videocodec *codec) in videocodec_register() argument
172 if (!codec) { in videocodec_register()
174 return -EINVAL; in videocodec_register()
177 zr = videocodec_to_zoran((struct videocodec *)codec); in videocodec_register()
181 codec->name, codec->type, codec->flags, codec->magic); in videocodec_register()
185 return -ENOMEM; in videocodec_register()
186 ptr->codec = codec; in videocodec_register()
192 while (h->next) in videocodec_register()
193 h = h->next; // find the end in videocodec_register()
194 h->next = ptr; in videocodec_register()
196 h->codec->name); in videocodec_register()
202 int videocodec_unregister(const struct videocodec *codec) in videocodec_unregister() argument
207 if (!codec) { in videocodec_unregister()
209 return -EINVAL; in videocodec_unregister()
212 zr = videocodec_to_zoran((struct videocodec *)codec); in videocodec_unregister()
216 codec->name, codec->type, codec->flags, codec->magic); in videocodec_unregister()
220 return -ENXIO; in videocodec_unregister()
224 if (codec == h->codec) { in videocodec_unregister()
225 if (h->attached) { in videocodec_unregister()
227 h->codec->name); in videocodec_unregister()
228 return -EBUSY; in videocodec_unregister()
231 h->codec->name); in videocodec_unregister()
233 codeclist_top = h->next; in videocodec_unregister()
237 prev->next = h->next; in videocodec_unregister()
245 h = h->next; in videocodec_unregister()
248 zrdev_err(zr, "%s: given codec not found!\n", __func__); in videocodec_unregister()
249 return -EINVAL; in videocodec_unregister()
262 h->codec->name, h->codec->type, in videocodec_debugfs_show()
263 h->codec->flags, h->codec->magic); in videocodec_debugfs_show()
264 a = h->list; in videocodec_debugfs_show()
267 a->codec->master_data->name, in videocodec_debugfs_show()
268 a->codec->master_data->type, in videocodec_debugfs_show()
269 a->codec->master_data->flags, in videocodec_debugfs_show()
270 a->codec->master_data->magic, in videocodec_debugfs_show()
271 a->codec->name); in videocodec_debugfs_show()
272 a = a->next; in videocodec_debugfs_show()
274 h = h->next; in videocodec_debugfs_show()