123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /*
- * Copyright (C) 2009 Felipe Contreras
- *
- * Author: Felipe Contreras <felipe.contreras@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
- #include "gstdspjpegenc.h"
- #include "plugin.h"
- #include "util.h"
- #include "dsp_bridge.h"
- #include "log.h"
- #define GST_CAT_DEFAULT gstdsp_debug
- static inline GstCaps *
- generate_src_template(void)
- {
- GstCaps *caps;
- GstStructure *struc;
- caps = gst_caps_new_empty();
- struc = gst_structure_new("image/jpeg",
- NULL);
- gst_caps_append_structure(caps, struc);
- return caps;
- }
- static void
- instance_init(GTypeInstance *instance,
- gpointer g_class)
- {
- GstDspBase *base = GST_DSP_BASE(instance);
- base->alg = GSTDSP_JPEGENC;
- du_port_free(base->ports[0]);
- du_port_free(base->ports[1]);
- base->ports[0] = du_port_new(0, 1);
- base->ports[1] = du_port_new(1, 1);
- base->use_eos_align = TRUE;
- }
- static void
- base_init(gpointer g_class)
- {
- GstElementClass *element_class;
- GstPadTemplate *template;
- GstElementDetails details;
- element_class = GST_ELEMENT_CLASS(g_class);
- details.longname = "DSP video encoder";
- details.klass = "Codec/Encoder/Image";
- details.description = "Encodes JPEG images with TI's DSP algorithms";
- details.author = "Felipe Contreras";
- gst_element_class_set_details(element_class, &details);
- template = gst_pad_template_new("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- generate_src_template());
- gst_element_class_add_pad_template(element_class, template);
- gst_object_unref(template);
- }
- GType
- gst_dsp_jpegenc_get_type(void)
- {
- static GType type = 0;
- if (G_UNLIKELY(type == 0)) {
- GTypeInfo type_info = {
- .class_size = sizeof(GstDspJpegEncClass),
- .base_init = base_init,
- .instance_size = sizeof(GstDspJpegEnc),
- .instance_init = instance_init,
- };
- type = g_type_register_static(GST_DSP_VENC_TYPE, "GstDspJpegEnc", &type_info, 0);
- }
- return type;
- }
|