mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
added jpeg and shout (icecastsend has been renamed to shout, there are other libs that do icecast too)
Original commit message from CVS: added jpeg and shout (icecastsend has been renamed to shout, there are other libs that do icecast too)
This commit is contained in:
parent
a784168b8c
commit
a38b8a35f6
8 changed files with 894 additions and 21 deletions
30
configure.ac
30
configure.ac
|
@ -504,11 +504,13 @@ dnl CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
|
|||
dnl AC_CHECK_HEADER(libdv/dv.h, :, HAVE_LIBDV=no)
|
||||
dnl CPPFLAGS="$libdvcheck_save_CPPFLAGS"
|
||||
|
||||
dnl *** libjpeg ***
|
||||
dnl *** jpeg ***
|
||||
dnl FIXME: we could use header checks here as well IMO
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBJPEG, true)
|
||||
GST_CHECK_FEATURE(LIBJPEG, [libjpeg], jpegenc jpegdec, [
|
||||
AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_LIBJPEG="yes", HAVE_LIBJPEG="no")
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_JPEG, true)
|
||||
GST_CHECK_FEATURE(JPEG, [jpeg], jpegenc jpegdec, [
|
||||
AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
|
||||
JPEG_LIBS="-ljpeg"
|
||||
AC_SUBST(JPEG_LIBS)
|
||||
])
|
||||
|
||||
dnl *** mad ***
|
||||
|
@ -565,9 +567,10 @@ GST_CHECK_FEATURE(SDL, [SDL plugin], sdlvideosink, [
|
|||
])
|
||||
|
||||
dnl *** shout ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBSHOUT, true)
|
||||
GST_CHECK_FEATURE(LIBSHOUT, [shout plugin], icecastsend, [
|
||||
GST_CHECK_LIBHEADER(LIBSHOUT, shout, shout_init_connection,, shout/shout.h, LIBSHOUT_LIBS="-lshout")
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT, true)
|
||||
GST_CHECK_FEATURE(SHOUT, [shout plugin], icecastsend, [
|
||||
GST_CHECK_LIBHEADER(SHOUT, shout, shout_init_connection,, shout/shout.h, SHOUT_LIBS="-lshout")
|
||||
AC_SUBST(SHOUT_LIBS)
|
||||
])
|
||||
|
||||
dnl for sidplay
|
||||
|
@ -861,14 +864,6 @@ if test "x$HAVE_LIBMIKMOD" = xyes; then
|
|||
AC_DEFINE(HAVE_LIBMIKMOD)
|
||||
fi
|
||||
|
||||
if test "x$HAVE_LIBJPEG" = xyes; then
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
fi
|
||||
|
||||
if test "x$HAVE_LIBHERMES" = "xyes"; then
|
||||
AC_DEFINE(HAVE_LIBHERMES)
|
||||
fi
|
||||
|
||||
if test "x$HAVE_A52DEC" = xyes; then
|
||||
AC_DEFINE(HAVE_A52DEC)
|
||||
fi
|
||||
|
@ -896,9 +891,7 @@ AM_CONDITIONAL(EXPERIMENTAL, test "$EXPERIMENTAL" = "$xyes")
|
|||
AM_CONDITIONAL(BROKEN, test "$BROKEN" = "$xyes")
|
||||
|
||||
AM_CONDITIONAL(HAVE_LIBMIKMOD, test "x$HAVE_LIBMIKMOD" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBJPEG, test "x$HAVE_LIBJPEG" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBSDL, test "x$HAVE_LIBSDL" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBHERMES, test "x$HAVE_LIBHERMES" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_NASM, test "x$HAVE_NASM" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBGLADE_GNOME, test "x$HAVE_LIBGLADE_GNOME" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_GNOME, test "x$HAVE_GNOME" = "xyes")
|
||||
|
@ -913,7 +906,6 @@ AM_CONDITIONAL(HAVE_PDFTOPS, $HAVE_PDFTOPS)
|
|||
AM_CONDITIONAL(HAVE_XSLTPROC, $HAVE_XSLTPROC)
|
||||
AM_CONDITIONAL(HAVE_FIG2DEV_PNG, $HAVE_FIG2DEV_PNG)
|
||||
AM_CONDITIONAL(HAVE_FIG2DEV_PDF, $HAVE_FIG2DEV_PDF)
|
||||
AM_CONDITIONAL(HAVE_LIBSHOUT, test "x$HAVE_LIBSHOUT" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBRTP, test "x$HAVE_LIBRTP" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_ARTS, test "x$HAVE_ARTS" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_XMMS, test "x$HAVE_XMMS" = "xyes")
|
||||
|
@ -1079,9 +1071,11 @@ ext/esd/Makefile
|
|||
ext/flac/Makefile
|
||||
ext/gsm/Makefile
|
||||
ext/hermes/Makefile
|
||||
ext/jpeg/Makefile
|
||||
ext/lame/Makefile
|
||||
ext/mad/Makefile
|
||||
ext/mpeg2dec/Makefile
|
||||
ext/shout/Makefile
|
||||
ext/sdl/Makefile
|
||||
ext/vorbis/Makefile
|
||||
gst-libs/Makefile
|
||||
|
|
|
@ -76,6 +76,13 @@ else
|
|||
LAME_DIR=
|
||||
endif
|
||||
|
||||
if USE_JPEG
|
||||
JPEG_DIR=jpeg
|
||||
else
|
||||
JPEG_DIR=
|
||||
endif
|
||||
|
||||
|
||||
if USE_MAD
|
||||
MAD_DIR=mad
|
||||
else
|
||||
|
@ -94,6 +101,12 @@ else
|
|||
SDL_DIR=
|
||||
endif
|
||||
|
||||
if USE_SHOUT
|
||||
SHOUT_DIR=shout
|
||||
else
|
||||
SHOUT_DIR=
|
||||
endif
|
||||
|
||||
if USE_VORBIS
|
||||
VORBIS_DIR=vorbis
|
||||
else
|
||||
|
@ -103,8 +116,8 @@ endif
|
|||
SUBDIRS=$(A52_DIR) $(AALIB_DIR) $(ALSA_DIR) $(AUDIOFILE_DIR) \
|
||||
$(AVIFILE_DIR) $(CDPARANOIA_DIR) $(DVDREAD_DIR) $(ESD_DIR) \
|
||||
$(FESTIVAL_DIR) $(FLAC_DIR) $(GSM_DIR) $(HERMES_DIR) \
|
||||
$(LAME_DIR) $(MAD_DIR) $(MPEG2DEC_DIR) \
|
||||
$(SDL_DIR) $(VORBIS_DIR)
|
||||
$(JPEG_DIR) $(LAME_DIR) $(MAD_DIR) $(MPEG2DEC_DIR) \
|
||||
$(SDL_DIR) $(SHOUT_DIR) $(VORBIS_DIR)
|
||||
|
||||
DIST_SUBDIRS=a52 aalib alsa avifile audiofile cdparanoia dvdread esd \
|
||||
festival flac gsm hermes lame mad mpeg2dec sdl vorbis
|
||||
festival flac gsm hermes jpeg lame mad mpeg2dec sdl shout vorbis
|
||||
|
|
11
ext/jpeg/Makefile.am
Normal file
11
ext/jpeg/Makefile.am
Normal file
|
@ -0,0 +1,11 @@
|
|||
plugindir = $(libdir)/gst
|
||||
|
||||
plugin_LTLIBRARIES = libgstjpeg.la
|
||||
|
||||
libgstjpeg_la_SOURCES = gstjpeg.c gstjpegdec.c gstjpegenc.c
|
||||
libgstjpeg_la_LIBADD = $(JPEG_LIBS)
|
||||
libgstjpeg_la_CFLAGS = $(GST_CFLAGS)
|
||||
## FIXME: check these CFLAGS
|
||||
## -O3 $(FOMIT_FRAME_POINTER) -funroll-all-loops -finline-functions -ffast-math -DNDEBUG
|
||||
|
||||
noinst_HEADERS = gstjpegdec.h gstjpegenc.h
|
112
ext/jpeg/gstjpeg.c
Normal file
112
ext/jpeg/gstjpeg.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
/* Gnome-Streamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "gstjpegdec.h"
|
||||
#include "gstjpegenc.h"
|
||||
|
||||
/* elementfactory information */
|
||||
extern GstElementDetails gst_jpegdec_details;
|
||||
extern GstElementDetails gst_jpegenc_details;
|
||||
|
||||
GstPadTemplate *jpegdec_src_template, *jpegdec_sink_template;
|
||||
GstPadTemplate *jpegenc_src_template, *jpegenc_sink_template;
|
||||
|
||||
static GstCaps*
|
||||
jpeg_caps_factory (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"jpeg_jpeg",
|
||||
"video/jpeg",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
raw_caps_factory (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"jpeg_raw",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"format", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
|
||||
),
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *dec, *enc;
|
||||
GstCaps *raw_caps, *jpeg_caps;
|
||||
|
||||
/* create an elementfactory for the jpegdec element */
|
||||
enc = gst_elementfactory_new("jpegenc",GST_TYPE_JPEGENC,
|
||||
&gst_jpegenc_details);
|
||||
g_return_val_if_fail(enc != NULL, FALSE);
|
||||
|
||||
raw_caps = raw_caps_factory ();
|
||||
jpeg_caps = jpeg_caps_factory ();
|
||||
|
||||
/* register sink pads */
|
||||
jpegenc_sink_template = gst_padtemplate_new ("sink", GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
raw_caps, NULL);
|
||||
gst_elementfactory_add_padtemplate (enc, jpegenc_sink_template);
|
||||
|
||||
/* register src pads */
|
||||
jpegenc_src_template = gst_padtemplate_new ("src", GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
jpeg_caps, NULL);
|
||||
gst_elementfactory_add_padtemplate (enc, jpegenc_src_template);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
|
||||
|
||||
/* create an elementfactory for the jpegdec element */
|
||||
dec = gst_elementfactory_new("jpegdec",GST_TYPE_JPEGDEC,
|
||||
&gst_jpegdec_details);
|
||||
g_return_val_if_fail(dec != NULL, FALSE);
|
||||
|
||||
/* register sink pads */
|
||||
jpegdec_sink_template = gst_padtemplate_new ("sink", GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
jpeg_caps, NULL);
|
||||
gst_elementfactory_add_padtemplate (dec, jpegdec_sink_template);
|
||||
|
||||
/* register src pads */
|
||||
jpegdec_src_template = gst_padtemplate_new ("src", GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
raw_caps, NULL);
|
||||
gst_elementfactory_add_padtemplate (dec, jpegdec_src_template);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GstPluginDesc plugin_desc = {
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"jpeg",
|
||||
plugin_init
|
||||
};
|
265
ext/jpeg/gstjpegdec.c
Normal file
265
ext/jpeg/gstjpegdec.c
Normal file
|
@ -0,0 +1,265 @@
|
|||
/* Gnome-Streamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//#define DEBUG_ENABLED
|
||||
#include "gstjpegdec.h"
|
||||
|
||||
extern GstPadTemplate *jpegdec_src_template, *jpegdec_sink_template;
|
||||
|
||||
/* elementfactory information */
|
||||
GstElementDetails gst_jpegdec_details = {
|
||||
"jpeg image decoder",
|
||||
"Filter/Decoder/Image",
|
||||
".jpeg",
|
||||
VERSION,
|
||||
"Wim Taymans <wim.taymans@tvd.be>",
|
||||
"(C) 2000",
|
||||
};
|
||||
|
||||
/* JpegDec signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
static void gst_jpegdec_class_init (GstJpegDec *klass);
|
||||
static void gst_jpegdec_init (GstJpegDec *jpegdec);
|
||||
|
||||
static void gst_jpegdec_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_jpegdec_get_type(void) {
|
||||
static GType jpegdec_type = 0;
|
||||
|
||||
if (!jpegdec_type) {
|
||||
static const GTypeInfo jpegdec_info = {
|
||||
sizeof(GstJpegDec), NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_jpegdec_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstJpegDec),
|
||||
0,
|
||||
(GInstanceInitFunc)gst_jpegdec_init,
|
||||
};
|
||||
jpegdec_type = g_type_register_static(GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info, 0);
|
||||
}
|
||||
return jpegdec_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_class_init (GstJpegDec *klass)
|
||||
{
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gstelement_class = (GstElementClass*)klass;
|
||||
|
||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_init_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: init_source\n");
|
||||
}
|
||||
static gboolean
|
||||
gst_jpegdec_fill_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: fill_input_buffer\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_skip_input_data (j_decompress_ptr cinfo, glong num_bytes)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: skip_input_data\n");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_jpegdec_resync_to_restart (j_decompress_ptr cinfo, gint desired)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: resync_to_start\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_term_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: term_source\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_init (GstJpegDec *jpegdec)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegdec_init: initializing\n");
|
||||
/* create the sink and src pads */
|
||||
jpegdec->sinkpad = gst_pad_new_from_template (jpegdec_sink_template, "sink");
|
||||
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->sinkpad);
|
||||
gst_pad_set_chain_function(jpegdec->sinkpad,gst_jpegdec_chain);
|
||||
jpegdec->srcpad = gst_pad_new_from_template (jpegdec_src_template, "src");
|
||||
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->srcpad);
|
||||
|
||||
/* initialize the jpegdec decoder state */
|
||||
jpegdec->next_time = 0;
|
||||
|
||||
// reset the initial video state
|
||||
jpegdec->format = -1;
|
||||
jpegdec->width = -1;
|
||||
jpegdec->height = -1;
|
||||
|
||||
jpegdec->line[0] = NULL;
|
||||
jpegdec->line[1] = NULL;
|
||||
jpegdec->line[2] = NULL;
|
||||
|
||||
/* setup jpeglib */
|
||||
memset(&jpegdec->cinfo, 0, sizeof(jpegdec->cinfo));
|
||||
memset(&jpegdec->jerr, 0, sizeof(jpegdec->jerr));
|
||||
jpegdec->cinfo.err = jpeg_std_error(&jpegdec->jerr);
|
||||
jpeg_create_decompress(&jpegdec->cinfo);
|
||||
|
||||
jpegdec->jsrc.init_source = gst_jpegdec_init_source;
|
||||
jpegdec->jsrc.fill_input_buffer = gst_jpegdec_fill_input_buffer;
|
||||
jpegdec->jsrc.skip_input_data = gst_jpegdec_skip_input_data;
|
||||
jpegdec->jsrc.resync_to_restart = gst_jpegdec_resync_to_restart;
|
||||
jpegdec->jsrc.term_source = gst_jpegdec_term_source;
|
||||
jpegdec->cinfo.src = &jpegdec->jsrc;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegdec_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstJpegDec *jpegdec;
|
||||
guchar *data, *outdata;
|
||||
gulong size, outsize;
|
||||
GstBuffer *outbuf;
|
||||
//GstMeta *meta;
|
||||
gint width, height, width2;
|
||||
guchar *base[3];
|
||||
gint i,j, k;
|
||||
gint r_h, r_v;
|
||||
|
||||
g_return_if_fail(pad != NULL);
|
||||
g_return_if_fail(GST_IS_PAD(pad));
|
||||
g_return_if_fail(buf != NULL);
|
||||
//g_return_if_fail(GST_IS_BUFFER(buf));
|
||||
|
||||
jpegdec = GST_JPEGDEC (GST_OBJECT_PARENT (pad));
|
||||
|
||||
if (!GST_PAD_CONNECTED (jpegdec->srcpad)) {
|
||||
gst_buffer_unref (buf);
|
||||
return;
|
||||
}
|
||||
|
||||
data = (guchar *)GST_BUFFER_DATA(buf);
|
||||
size = GST_BUFFER_SIZE(buf);
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: got buffer of %ld bytes in '%s'\n",size,
|
||||
GST_OBJECT_NAME (jpegdec));
|
||||
|
||||
jpegdec->jsrc.next_input_byte = data;
|
||||
jpegdec->jsrc.bytes_in_buffer = size;
|
||||
|
||||
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: reading header %08lx\n", *(gulong *)data);
|
||||
jpeg_read_header(&jpegdec->cinfo, TRUE);
|
||||
|
||||
r_h = jpegdec->cinfo.cur_comp_info[0]->h_samp_factor;
|
||||
r_v = jpegdec->cinfo.cur_comp_info[0]->v_samp_factor;
|
||||
|
||||
//g_print ("%d %d\n", r_h, r_v);
|
||||
//g_print ("%d %d\n", jpegdec->cinfo.cur_comp_info[1]->h_samp_factor, jpegdec->cinfo.cur_comp_info[1]->v_samp_factor);
|
||||
//g_print ("%d %d\n", jpegdec->cinfo.cur_comp_info[2]->h_samp_factor, jpegdec->cinfo.cur_comp_info[2]->v_samp_factor);
|
||||
|
||||
jpegdec->cinfo.do_fancy_upsampling = FALSE;
|
||||
jpegdec->cinfo.do_block_smoothing = FALSE;
|
||||
jpegdec->cinfo.out_color_space = JCS_YCbCr;
|
||||
jpegdec->cinfo.dct_method = JDCT_IFAST;
|
||||
jpegdec->cinfo.raw_data_out = TRUE;
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: starting decompress\n");
|
||||
jpeg_start_decompress(&jpegdec->cinfo);
|
||||
width = jpegdec->cinfo.output_width;
|
||||
height = jpegdec->cinfo.output_height;
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: width %d, height %d\n", width, height);
|
||||
|
||||
outbuf = gst_buffer_new();
|
||||
outsize = GST_BUFFER_SIZE(outbuf) = width*height +
|
||||
width*height / 2;
|
||||
outdata = GST_BUFFER_DATA(outbuf) = g_malloc(outsize);
|
||||
GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
|
||||
|
||||
if (jpegdec->height != height) {
|
||||
jpegdec->line[0] = g_realloc(jpegdec->line[0], height*sizeof(char*));
|
||||
jpegdec->line[1] = g_realloc(jpegdec->line[1], height*sizeof(char*));
|
||||
jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*));
|
||||
jpegdec->height = height;
|
||||
|
||||
gst_pad_set_caps (jpegdec->srcpad, gst_caps_new (
|
||||
"jpegdec_caps",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
|
||||
"width", GST_PROPS_INT (width),
|
||||
"height", GST_PROPS_INT (height),
|
||||
NULL)));
|
||||
}
|
||||
|
||||
/* mind the swap, jpeglib outputs blue chroma first */
|
||||
base[0] = outdata;
|
||||
base[1] = base[0]+width*height;
|
||||
base[2] = base[1]+width*height/4;
|
||||
|
||||
width2 = width >> 1;
|
||||
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: decompressing %u\n", jpegdec->cinfo.rec_outbuf_height);
|
||||
for (i = 0; i < height; i += r_v*DCTSIZE) {
|
||||
for (j=0, k=0; j< (r_v*DCTSIZE); j += r_v, k++) {
|
||||
jpegdec->line[0][j] = base[0]; base[0] += width;
|
||||
if (r_v == 2) {
|
||||
jpegdec->line[0][j+1] = base[0]; base[0] += width;
|
||||
}
|
||||
jpegdec->line[1][k] = base[1];
|
||||
jpegdec->line[2][k] = base[2];
|
||||
if (r_v == 2 || k&1) {
|
||||
base[1] += width2; base[2] += width2;
|
||||
}
|
||||
}
|
||||
//g_print ("%d\n", jpegdec->cinfo.output_scanline);
|
||||
jpeg_read_raw_data(&jpegdec->cinfo, jpegdec->line, r_v*DCTSIZE);
|
||||
}
|
||||
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: decompressing finished\n");
|
||||
jpeg_finish_decompress(&jpegdec->cinfo);
|
||||
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: sending buffer\n");
|
||||
gst_pad_push(jpegdec->srcpad, outbuf);
|
||||
|
||||
gst_buffer_unref(buf);
|
||||
}
|
||||
|
87
ext/jpeg/gstjpegdec.h
Normal file
87
ext/jpeg/gstjpegdec.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* Gnome-Streamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_JPEGDEC_H__
|
||||
#define __GST_JPEGDEC_H__
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <jpeglib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GST_TYPE_JPEGDEC \
|
||||
(gst_jpegdec_get_type())
|
||||
#define GST_JPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEGDEC,GstJpegDec))
|
||||
#define GST_JPEGDEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEGDEC,GstJpegDec))
|
||||
#define GST_IS_JPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEGDEC))
|
||||
#define GST_IS_JPEGDEC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEGDEC))
|
||||
|
||||
typedef struct _GstJpegDec GstJpegDec;
|
||||
typedef struct _GstJpegDecClass GstJpegDecClass;
|
||||
|
||||
struct _GstJpegDec {
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
GstPad *sinkpad,*srcpad;
|
||||
|
||||
int parse_state;
|
||||
// the timestamp of the next frame
|
||||
guint64 next_time;
|
||||
// the interval between frames
|
||||
guint64 time_interval;
|
||||
|
||||
// video state
|
||||
gint format;
|
||||
gint width;
|
||||
gint height;
|
||||
// the size of the output buffer
|
||||
gint outsize;
|
||||
// the jpeg line buffer
|
||||
guchar **line[3];
|
||||
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
struct jpeg_source_mgr jsrc;
|
||||
};
|
||||
|
||||
struct _GstJpegDecClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_jpegdec_get_type(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GST_JPEGDEC_H__ */
|
304
ext/jpeg/gstjpegenc.c
Normal file
304
ext/jpeg/gstjpegenc.c
Normal file
|
@ -0,0 +1,304 @@
|
|||
/* Gnome-Streamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gstjpegenc.h"
|
||||
|
||||
/* elementfactory information */
|
||||
GstElementDetails gst_jpegenc_details = {
|
||||
"jpeg image encoder",
|
||||
"Filter/Encoder/Image",
|
||||
".jpeg",
|
||||
VERSION,
|
||||
"Wim Taymans <wim.taymans@tvd.be>",
|
||||
"(C) 2000",
|
||||
};
|
||||
|
||||
/* JpegEnc signals and args */
|
||||
enum {
|
||||
FRAME_ENCODED,
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
static void gst_jpegenc_class_init (GstJpegEnc *klass);
|
||||
static void gst_jpegenc_init (GstJpegEnc *jpegenc);
|
||||
|
||||
static void gst_jpegenc_chain (GstPad *pad,GstBuffer *buf);
|
||||
static GstBuffer *gst_jpegenc_get (GstPad *pad);
|
||||
|
||||
static void gst_jpegenc_resync (GstJpegEnc *jpegenc);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_jpegenc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_jpegenc_get_type (void)
|
||||
{
|
||||
static GType jpegenc_type = 0;
|
||||
|
||||
if (!jpegenc_type) {
|
||||
static const GTypeInfo jpegenc_info = {
|
||||
sizeof(GstJpegEnc), NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_jpegenc_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstJpegEnc),
|
||||
0,
|
||||
(GInstanceInitFunc)gst_jpegenc_init,
|
||||
};
|
||||
jpegenc_type = g_type_register_static(GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info, 0);
|
||||
}
|
||||
return jpegenc_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegenc_class_init (GstJpegEnc *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass*)klass;
|
||||
gstelement_class = (GstElementClass*)klass;
|
||||
|
||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||
|
||||
gst_jpegenc_signals[FRAME_ENCODED] =
|
||||
g_signal_new ("frame_encoded", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstJpegEncClass, frame_encoded), NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegenc_init_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: init_destination\n");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_jpegenc_flush_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: flush_destination: buffer too small !!!\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void gst_jpegenc_term_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: term_source\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegenc_init (GstJpegEnc *jpegenc)
|
||||
{
|
||||
/* create the sink and src pads */
|
||||
jpegenc->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
|
||||
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->sinkpad);
|
||||
gst_pad_set_chain_function(jpegenc->sinkpad,gst_jpegenc_chain);
|
||||
gst_pad_set_get_function(jpegenc->sinkpad,gst_jpegenc_get);
|
||||
jpegenc->srcpad = gst_pad_new("src",GST_PAD_SRC);
|
||||
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->srcpad);
|
||||
|
||||
// reset the initial video state
|
||||
jpegenc->width = -1;
|
||||
jpegenc->height = -1;
|
||||
|
||||
/* setup jpeglib */
|
||||
memset(&jpegenc->cinfo, 0, sizeof(jpegenc->cinfo));
|
||||
memset(&jpegenc->jerr, 0, sizeof(jpegenc->jerr));
|
||||
jpegenc->cinfo.err = jpeg_std_error(&jpegenc->jerr);
|
||||
jpeg_create_compress(&jpegenc->cinfo);
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_init: setting line buffers\n");
|
||||
jpegenc->line[0] = NULL;
|
||||
jpegenc->line[1] = NULL;
|
||||
jpegenc->line[2] = NULL;
|
||||
|
||||
gst_jpegenc_resync(jpegenc);
|
||||
|
||||
jpegenc->jdest.init_destination = gst_jpegenc_init_destination;
|
||||
jpegenc->jdest.empty_output_buffer = gst_jpegenc_flush_destination;
|
||||
jpegenc->jdest.term_destination = gst_jpegenc_term_destination;
|
||||
jpegenc->cinfo.dest = &jpegenc->jdest;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegenc_resync (GstJpegEnc *jpegenc)
|
||||
{
|
||||
guint size = 0;
|
||||
gint width, height;
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: resync\n");
|
||||
|
||||
jpegenc->cinfo.image_width = width = jpegenc->width;
|
||||
jpegenc->cinfo.image_height = height = jpegenc->height;
|
||||
jpegenc->cinfo.input_components = 3;
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: wdith %d, height %d\n", width, height);
|
||||
|
||||
jpeg_set_defaults(&jpegenc->cinfo);
|
||||
jpegenc->cinfo.dct_method = JDCT_FASTEST;
|
||||
//jpegenc->cinfo.dct_method = JDCT_DEFAULT;
|
||||
//jpegenc->cinfo.smoothing_factor = 10;
|
||||
jpeg_set_quality(&jpegenc->cinfo, 85, TRUE);
|
||||
|
||||
/*
|
||||
switch (jpegenc->format) {
|
||||
case GST_COLORSPACE_RGB24:
|
||||
size = 3;
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: setting format to RGB24\n");
|
||||
jpegenc->cinfo.in_color_space = JCS_RGB;
|
||||
jpegenc->cinfo.raw_data_in = FALSE;
|
||||
break;
|
||||
case GST_COLORSPACE_YUV420P:
|
||||
size = 2;
|
||||
jpegenc->cinfo.raw_data_in = TRUE;
|
||||
jpegenc->cinfo.in_color_space = JCS_YCbCr;
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: setting format to YUV420P\n");
|
||||
jpegenc->cinfo.comp_info[0].h_samp_factor = 2;
|
||||
jpegenc->cinfo.comp_info[0].v_samp_factor = 2;
|
||||
jpegenc->cinfo.comp_info[1].h_samp_factor = 1;
|
||||
jpegenc->cinfo.comp_info[1].v_samp_factor = 1;
|
||||
jpegenc->cinfo.comp_info[2].h_samp_factor = 1;
|
||||
jpegenc->cinfo.comp_info[2].v_samp_factor = 1;
|
||||
|
||||
if (height != -1) {
|
||||
jpegenc->line[0] = g_realloc(jpegenc->line[0], height*sizeof(char*));
|
||||
jpegenc->line[1] = g_realloc(jpegenc->line[1], height*sizeof(char*)/2);
|
||||
jpegenc->line[2] = g_realloc(jpegenc->line[2], height*sizeof(char*)/2);
|
||||
}
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: setting format done\n");
|
||||
break;
|
||||
default:
|
||||
printf("gst_jpegenc_resync: unsupported colorspace, using RGB\n");
|
||||
size = 3;
|
||||
jpegenc->cinfo.in_color_space = JCS_RGB;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
jpegenc->bufsize = jpegenc->width*jpegenc->height*size;
|
||||
jpegenc->row_stride = width * size;
|
||||
|
||||
jpeg_suppress_tables(&jpegenc->cinfo, TRUE);
|
||||
|
||||
jpegenc->buffer = NULL;
|
||||
GST_DEBUG (0,"gst_jpegenc_resync: resync done\n");
|
||||
}
|
||||
|
||||
static GstBuffer*
|
||||
gst_jpegenc_get (GstPad *pad)
|
||||
{
|
||||
GstJpegEnc *jpegenc;
|
||||
GstBuffer *newbuf;
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: pull buffer\n");
|
||||
|
||||
g_return_val_if_fail (pad != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
jpegenc = GST_JPEGENC (GST_OBJECT_PARENT (pad));
|
||||
|
||||
if (jpegenc->buffer == NULL || GST_BUFFER_REFCOUNT(jpegenc->buffer) != 1) {
|
||||
if (jpegenc->buffer) gst_buffer_unref(jpegenc->buffer);
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: new buffer\n");
|
||||
newbuf = jpegenc->buffer = gst_buffer_new();
|
||||
GST_BUFFER_DATA(newbuf) = g_malloc(jpegenc->bufsize);
|
||||
GST_BUFFER_SIZE(newbuf) = jpegenc->bufsize;
|
||||
}
|
||||
gst_buffer_ref(jpegenc->buffer);
|
||||
|
||||
return jpegenc->buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_jpegenc_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstJpegEnc *jpegenc;
|
||||
guchar *data, *outdata;
|
||||
gulong size, outsize;
|
||||
GstBuffer *outbuf;
|
||||
// GstMeta *meta;
|
||||
guint height, width, width2;
|
||||
guchar *base[3];
|
||||
gint i,j, k;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
//g_return_if_fail(GST_IS_BUFFER(buf));
|
||||
|
||||
//usleep(10000);
|
||||
jpegenc = GST_JPEGENC (GST_OBJECT_PARENT (pad));
|
||||
|
||||
data = GST_BUFFER_DATA(buf);
|
||||
size = GST_BUFFER_SIZE(buf);
|
||||
|
||||
GST_DEBUG (0,"gst_jpegenc_chain: got buffer of %ld bytes in '%s'\n",size,
|
||||
GST_OBJECT_NAME (jpegenc));
|
||||
|
||||
outbuf = gst_buffer_new();
|
||||
outsize = GST_BUFFER_SIZE(outbuf) = jpegenc->bufsize;
|
||||
outdata = GST_BUFFER_DATA(outbuf) = g_malloc(outsize);
|
||||
GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
|
||||
|
||||
width = jpegenc->width;
|
||||
height = jpegenc->height;
|
||||
|
||||
base[0] = data;
|
||||
base[1] = base[0]+width*height;
|
||||
base[2] = base[1]+width*height/4;
|
||||
|
||||
jpegenc->jdest.next_output_byte = outdata;
|
||||
jpegenc->jdest.free_in_buffer = outsize;
|
||||
|
||||
jpeg_start_compress(&jpegenc->cinfo, TRUE);
|
||||
|
||||
width2 = width>>1;
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: compressing\n");
|
||||
|
||||
for (i = 0; i < height; i += 2*DCTSIZE) {
|
||||
for (j=0, k=0; j<2*DCTSIZE;j+=2, k++) {
|
||||
jpegenc->line[0][j] = base[0]; base[0] += width;
|
||||
jpegenc->line[0][j+1] = base[0]; base[0] += width;
|
||||
jpegenc->line[1][k] = base[1]; base[1] += width2;
|
||||
jpegenc->line[2][k] = base[2]; base[2] += width2;
|
||||
}
|
||||
jpeg_write_raw_data(&jpegenc->cinfo, jpegenc->line, 2*DCTSIZE);
|
||||
}
|
||||
jpeg_finish_compress(&jpegenc->cinfo);
|
||||
GST_DEBUG (0,"gst_jpegdec_chain: compressing done\n");
|
||||
|
||||
GST_BUFFER_SIZE(outbuf) = (((outsize - jpegenc->jdest.free_in_buffer)+3)&~3);
|
||||
|
||||
gst_pad_push(jpegenc->srcpad, outbuf);
|
||||
|
||||
g_signal_emit(G_OBJECT(jpegenc),gst_jpegenc_signals[FRAME_ENCODED], 0);
|
||||
|
||||
gst_buffer_unref(buf);
|
||||
}
|
87
ext/jpeg/gstjpegenc.h
Normal file
87
ext/jpeg/gstjpegenc.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* Gnome-Streamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_JPEGENC_H__
|
||||
#define __GST_JPEGENC_H__
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <jpeglib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GST_TYPE_JPEGENC \
|
||||
(gst_jpegenc_get_type())
|
||||
#define GST_JPEGENC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEGENC,GstJpegEnc))
|
||||
#define GST_JPEGENC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEGENC,GstJpegEnc))
|
||||
#define GST_IS_JPEGENC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEGENC))
|
||||
#define GST_IS_JPEGENC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEGENC))
|
||||
|
||||
typedef struct _GstJpegEnc GstJpegEnc;
|
||||
typedef struct _GstJpegEncClass GstJpegEncClass;
|
||||
|
||||
struct _GstJpegEnc {
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
GstPad *sinkpad,*srcpad;
|
||||
|
||||
// video state
|
||||
gint format;
|
||||
gint width;
|
||||
gint height;
|
||||
// the video buffer
|
||||
gint bufsize;
|
||||
GstBuffer *buffer;
|
||||
guint row_stride;
|
||||
// the jpeg line buffer
|
||||
guchar **line[3];
|
||||
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
struct jpeg_destination_mgr jdest;
|
||||
|
||||
};
|
||||
|
||||
struct _GstJpegEncClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*frame_encoded) (GstElement *element);
|
||||
};
|
||||
|
||||
GType gst_jpegenc_get_type(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GST_JPEGENC_H__ */
|
Loading…
Reference in a new issue