mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
docs/plugins/: Added smoke and jpeg to the docs.
Original commit message from CVS: * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-good-plugins-docs.sgml: * docs/plugins/gst-plugins-good-plugins-sections.txt: * docs/plugins/gst-plugins-good-plugins.hierarchy: Added smoke and jpeg to the docs. * ext/jpeg/Makefile.am: * ext/jpeg/gstjpeg.c: (plugin_init): * ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_chain): * ext/jpeg/gstjpegenc.h: * ext/jpeg/gstsmokedec.c: (gst_smokedec_init), (gst_smokedec_chain): * ext/jpeg/gstsmokedec.h: * ext/jpeg/gstsmokeenc.c: (gst_smokeenc_chain): * ext/jpeg/gstsmokeenc.h: * ext/jpeg/smokecodec.h: Port smokedec (fixes #331905). Added some docs. Some cleanups.
This commit is contained in:
parent
e85d1638c3
commit
188bd155cd
14 changed files with 197 additions and 122 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
2006-03-03 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* docs/plugins/Makefile.am:
|
||||||
|
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
|
||||||
|
* docs/plugins/gst-plugins-good-plugins-sections.txt:
|
||||||
|
* docs/plugins/gst-plugins-good-plugins.hierarchy:
|
||||||
|
Added smoke and jpeg to the docs.
|
||||||
|
|
||||||
|
* ext/jpeg/Makefile.am:
|
||||||
|
* ext/jpeg/gstjpeg.c: (plugin_init):
|
||||||
|
* ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_chain):
|
||||||
|
* ext/jpeg/gstjpegenc.h:
|
||||||
|
* ext/jpeg/gstsmokedec.c: (gst_smokedec_init),
|
||||||
|
(gst_smokedec_chain):
|
||||||
|
* ext/jpeg/gstsmokedec.h:
|
||||||
|
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_chain):
|
||||||
|
* ext/jpeg/gstsmokeenc.h:
|
||||||
|
* ext/jpeg/smokecodec.h:
|
||||||
|
Port smokedec (fixes #331905).
|
||||||
|
Added some docs.
|
||||||
|
Some cleanups.
|
||||||
|
|
||||||
2006-03-03 Wim Taymans <wim@fluendo.com>
|
2006-03-03 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* docs/plugins/Makefile.am:
|
* docs/plugins/Makefile.am:
|
||||||
|
|
|
@ -87,6 +87,10 @@ EXTRA_HFILES = \
|
||||||
$(top_srcdir)/ext/flac/gstflacdec.h \
|
$(top_srcdir)/ext/flac/gstflacdec.h \
|
||||||
$(top_srcdir)/ext/hal/gsthalaudiosink.h \
|
$(top_srcdir)/ext/hal/gsthalaudiosink.h \
|
||||||
$(top_srcdir)/ext/hal/gsthalaudiosrc.h \
|
$(top_srcdir)/ext/hal/gsthalaudiosrc.h \
|
||||||
|
$(top_srcdir)/ext/jpeg/gstjpegdec.h \
|
||||||
|
$(top_srcdir)/ext/jpeg/gstjpegenc.h \
|
||||||
|
$(top_srcdir)/ext/jpeg/gstsmokedec.h \
|
||||||
|
$(top_srcdir)/ext/jpeg/gstsmokeenc.h \
|
||||||
$(top_srcdir)/gst/multipart/multipartmux.c \
|
$(top_srcdir)/gst/multipart/multipartmux.c \
|
||||||
$(top_srcdir)/gst/multipart/multipartdemux.c \
|
$(top_srcdir)/gst/multipart/multipartdemux.c \
|
||||||
$(top_srcdir)/gst/udp/gstudpsrc.h \
|
$(top_srcdir)/gst/udp/gstudpsrc.h \
|
||||||
|
|
|
@ -24,11 +24,15 @@
|
||||||
<xi:include href="xml/element-halaudiosink.xml" />
|
<xi:include href="xml/element-halaudiosink.xml" />
|
||||||
<xi:include href="xml/element-halaudiosrc.xml" />
|
<xi:include href="xml/element-halaudiosrc.xml" />
|
||||||
<xi:include href="xml/element-id3demux.xml" />
|
<xi:include href="xml/element-id3demux.xml" />
|
||||||
|
<xi:include href="xml/element-jpegdec.xml" />
|
||||||
|
<xi:include href="xml/element-jpegenc.xml" />
|
||||||
<xi:include href="xml/element-level.xml" />
|
<xi:include href="xml/element-level.xml" />
|
||||||
<xi:include href="xml/element-udpsrc.xml" />
|
<xi:include href="xml/element-udpsrc.xml" />
|
||||||
<xi:include href="xml/element-multiudpsink.xml" />
|
<xi:include href="xml/element-multiudpsink.xml" />
|
||||||
<xi:include href="xml/element-multipartmux.xml" />
|
<xi:include href="xml/element-multipartmux.xml" />
|
||||||
<xi:include href="xml/element-multipartdemux.xml" />
|
<xi:include href="xml/element-multipartdemux.xml" />
|
||||||
|
<xi:include href="xml/element-smokedec.xml" />
|
||||||
|
<xi:include href="xml/element-smokeenc.xml" />
|
||||||
<xi:include href="xml/element-videobalance.xml" />
|
<xi:include href="xml/element-videobalance.xml" />
|
||||||
<xi:include href="xml/element-videoflip.xml" />
|
<xi:include href="xml/element-videoflip.xml" />
|
||||||
<xi:include href="xml/element-videomixer.xml" />
|
<xi:include href="xml/element-videomixer.xml" />
|
||||||
|
|
|
@ -94,6 +94,64 @@ GstHalAudioSrc
|
||||||
GstHalAudioSrcClass
|
GstHalAudioSrcClass
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>element-jpegdec</FILE>
|
||||||
|
GstJpegDec
|
||||||
|
GstJpegDecErrorMgr
|
||||||
|
GstJpegDecSourceMgr
|
||||||
|
<TITLE>jpegdec</TITLE>
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GstJpegDecClass
|
||||||
|
GST_JPEG_DEC
|
||||||
|
GST_IS_JPEG_DEC
|
||||||
|
GST_TYPE_JPEG_DEC
|
||||||
|
gst_jpeg_dec_get_type
|
||||||
|
GST_JPEG_DEC_CLASS
|
||||||
|
GST_IS_JPEG_DEC_CLASS
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>element-jpegenc</FILE>
|
||||||
|
<TITLE>jpegenc</TITLE>
|
||||||
|
GstJpegEnc
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GstJpegEncClass
|
||||||
|
GST_JPEGENC
|
||||||
|
GST_IS_JPEGENC
|
||||||
|
GST_TYPE_JPEGENC
|
||||||
|
gst_jpegenc_get_type
|
||||||
|
GST_JPEGENC_CLASS
|
||||||
|
GST_IS_JPEGENC_CLASS
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>element-smokedec</FILE>
|
||||||
|
GstSmokeDec
|
||||||
|
<TITLE>smokedec</TITLE>
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GstSmokeDecClass
|
||||||
|
GST_SMOKEDEC
|
||||||
|
GST_IS_SMOKEDEC
|
||||||
|
GST_TYPE_SMOKEDEC
|
||||||
|
gst_smokedec_get_type
|
||||||
|
GST_SMOKEDEC_CLASS
|
||||||
|
GST_IS_SMOKEDEC_CLASS
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>element-smokeenc</FILE>
|
||||||
|
GstSmokeEnc
|
||||||
|
<TITLE>smokeenc</TITLE>
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GstSmokeEncClass
|
||||||
|
GST_SMOKEENC
|
||||||
|
GST_IS_SMOKEENC
|
||||||
|
GST_TYPE_SMOKEENC
|
||||||
|
gst_smokeenc_get_type
|
||||||
|
GST_SMOKEENC_CLASS
|
||||||
|
GST_IS_SMOKEENC_CLASS
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>element-id3demux</FILE>
|
<FILE>element-id3demux</FILE>
|
||||||
GstID3Demux
|
GstID3Demux
|
||||||
|
|
|
@ -39,6 +39,7 @@ GObject
|
||||||
GstPngEnc
|
GstPngEnc
|
||||||
GstJpegEnc
|
GstJpegEnc
|
||||||
GstJpegDec
|
GstJpegDec
|
||||||
|
GstSmokeDec
|
||||||
GstSmokeEnc
|
GstSmokeEnc
|
||||||
GstFlacEnc
|
GstFlacEnc
|
||||||
GstFlacDec
|
GstFlacDec
|
||||||
|
|
|
@ -5,9 +5,8 @@ libgstjpeg_la_SOURCES = \
|
||||||
gstjpegenc.c \
|
gstjpegenc.c \
|
||||||
gstjpegdec.c \
|
gstjpegdec.c \
|
||||||
gstsmokeenc.c \
|
gstsmokeenc.c \
|
||||||
smokecodec.c
|
smokecodec.c \
|
||||||
|
gstsmokedec.c
|
||||||
# gstsmokedec.c
|
|
||||||
|
|
||||||
libgstjpeg_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
libgstjpeg_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
||||||
libgstjpeg_la_LIBADD = $(GST_LIBS) $(JPEG_LIBS)
|
libgstjpeg_la_LIBADD = $(GST_LIBS) $(JPEG_LIBS)
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
#include "gstjpegdec.h"
|
#include "gstjpegdec.h"
|
||||||
#include "gstjpegenc.h"
|
#include "gstjpegenc.h"
|
||||||
#include "gstsmokeenc.h"
|
#include "gstsmokeenc.h"
|
||||||
/*
|
|
||||||
#include "gstsmokedec.h"
|
#include "gstsmokedec.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
static GstStaticCaps smoke_caps = GST_STATIC_CAPS ("video/x-smoke");
|
static GstStaticCaps smoke_caps = GST_STATIC_CAPS ("video/x-smoke");
|
||||||
|
|
||||||
#define SMOKE_CAPS (gst_static_caps_get(&smoke_caps))
|
#define SMOKE_CAPS (gst_static_caps_get(&smoke_caps))
|
||||||
static void
|
static void
|
||||||
smoke_type_find (GstTypeFind * tf, gpointer private)
|
smoke_type_find (GstTypeFind * tf, gpointer private)
|
||||||
|
@ -46,7 +46,7 @@ smoke_type_find (GstTypeFind * tf, gpointer private)
|
||||||
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SMOKE_CAPS);
|
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SMOKE_CAPS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
|
@ -63,15 +63,16 @@ plugin_init (GstPlugin * plugin)
|
||||||
if (!gst_element_register (plugin, "smokeenc", GST_RANK_PRIMARY,
|
if (!gst_element_register (plugin, "smokeenc", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_SMOKEENC))
|
GST_TYPE_SMOKEENC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/*
|
|
||||||
if (!gst_element_register (plugin, "smokedec", GST_RANK_PRIMARY,
|
if (!gst_element_register (plugin, "smokedec", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_SMOKEDEC))
|
GST_TYPE_SMOKEDEC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (!gst_type_find_register (plugin, "video/x-smoke", GST_RANK_PRIMARY,
|
if (!gst_type_find_register (plugin, "video/x-smoke", GST_RANK_PRIMARY,
|
||||||
smoke_type_find, NULL, SMOKE_CAPS, NULL))
|
smoke_type_find, NULL, SMOKE_CAPS, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -828,8 +828,8 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
GstClockTime next_ts;
|
GstClockTime next_ts;
|
||||||
|
|
||||||
dec->frames_decoded++;
|
dec->frames_decoded++;
|
||||||
next_ts = dec->frames_decoded * GST_SECOND *
|
next_ts = gst_util_uint64_scale (dec->frames_decoded,
|
||||||
dec->framerate_denominator / dec->framerate_numerator;
|
GST_SECOND * dec->framerate_denominator, dec->framerate_numerator);
|
||||||
|
|
||||||
duration = next_ts - dec->next_ts;
|
duration = next_ts - dec->next_ts;
|
||||||
dec->next_ts = next_ts;
|
dec->next_ts = next_ts;
|
||||||
|
|
|
@ -29,10 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_JPEGENC \
|
#define GST_TYPE_JPEGENC \
|
||||||
(gst_jpegenc_get_type())
|
(gst_jpegenc_get_type())
|
||||||
|
@ -82,10 +79,6 @@ struct _GstJpegEncClass {
|
||||||
|
|
||||||
GType gst_jpegenc_get_type(void);
|
GType gst_jpegenc_get_type(void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_JPEGENC_H__ */
|
#endif /* __GST_JPEGENC_H__ */
|
||||||
|
|
|
@ -41,22 +41,19 @@ GST_DEBUG_CATEGORY (smokedec_debug);
|
||||||
/* SmokeDec signals and args */
|
/* SmokeDec signals and args */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0
|
PROP_0
|
||||||
/* FILL ME */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_smokedec_base_init (gpointer g_class);
|
static void gst_smokedec_base_init (gpointer g_class);
|
||||||
static void gst_smokedec_class_init (GstSmokeDec * klass);
|
static void gst_smokedec_class_init (GstSmokeDec * klass);
|
||||||
static void gst_smokedec_init (GstSmokeDec * smokedec);
|
static void gst_smokedec_init (GstSmokeDec * smokedec);
|
||||||
|
|
||||||
static void gst_smokedec_chain (GstPad * pad, GstData * _data);
|
static GstFlowReturn gst_smokedec_chain (GstPad * pad, GstBuffer * buf);
|
||||||
static GstPadLinkReturn gst_smokedec_link (GstPad * pad, const GstCaps * caps);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
@ -100,7 +97,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("video/x-smoke, "
|
GST_STATIC_CAPS ("video/x-smoke, "
|
||||||
"width = (int) [ 16, 4096 ], "
|
"width = (int) [ 16, 4096 ], "
|
||||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
|
"height = (int) [ 16, 4096 ], " "framerate = (fraction) [ 0/1, MAX ]")
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -130,94 +127,96 @@ gst_smokedec_class_init (GstSmokeDec * klass)
|
||||||
static void
|
static void
|
||||||
gst_smokedec_init (GstSmokeDec * smokedec)
|
gst_smokedec_init (GstSmokeDec * smokedec)
|
||||||
{
|
{
|
||||||
GST_DEBUG ("gst_smokedec_init: initializing");
|
GST_DEBUG_OBJECT (smokedec, "gst_smokedec_init: initializing");
|
||||||
/* create the sink and src pads */
|
/* create the sink and src pads */
|
||||||
|
|
||||||
smokedec->sinkpad =
|
smokedec->sinkpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&gst_smokedec_sink_pad_template), "sink");
|
(&gst_smokedec_sink_pad_template), "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (smokedec), smokedec->sinkpad);
|
|
||||||
gst_pad_set_chain_function (smokedec->sinkpad, gst_smokedec_chain);
|
gst_pad_set_chain_function (smokedec->sinkpad, gst_smokedec_chain);
|
||||||
gst_pad_set_link_function (smokedec->sinkpad, gst_smokedec_link);
|
gst_element_add_pad (GST_ELEMENT (smokedec), smokedec->sinkpad);
|
||||||
|
|
||||||
smokedec->srcpad =
|
smokedec->srcpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&gst_smokedec_src_pad_template), "src");
|
(&gst_smokedec_src_pad_template), "src");
|
||||||
gst_pad_use_explicit_caps (smokedec->srcpad);
|
gst_pad_use_fixed_caps (smokedec->srcpad);
|
||||||
gst_element_add_pad (GST_ELEMENT (smokedec), smokedec->srcpad);
|
gst_element_add_pad (GST_ELEMENT (smokedec), smokedec->srcpad);
|
||||||
|
|
||||||
/* reset the initial video state */
|
/* reset the initial video state */
|
||||||
smokedec->format = -1;
|
smokedec->format = -1;
|
||||||
smokedec->width = -1;
|
smokedec->width = -1;
|
||||||
smokedec->height = -1;
|
smokedec->height = -1;
|
||||||
|
smokedec->fps_num = -1;
|
||||||
|
smokedec->fps_denom = -1;
|
||||||
smokedec->next_time = 0;
|
smokedec->next_time = 0;
|
||||||
}
|
|
||||||
|
|
||||||
static GstPadLinkReturn
|
|
||||||
gst_smokedec_link (GstPad * pad, const GstCaps * caps)
|
|
||||||
{
|
|
||||||
GstSmokeDec *smokedec = GST_SMOKEDEC (gst_pad_get_parent (pad));
|
|
||||||
GstStructure *structure;
|
|
||||||
GstCaps *srccaps;
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
|
||||||
|
|
||||||
gst_structure_get_double (structure, "framerate", &smokedec->fps);
|
|
||||||
gst_structure_get_int (structure, "width", &smokedec->width);
|
|
||||||
gst_structure_get_int (structure, "height", &smokedec->height);
|
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/x-raw-yuv",
|
|
||||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
|
||||||
"width", G_TYPE_INT, smokedec->width,
|
|
||||||
"height", G_TYPE_INT, smokedec->height,
|
|
||||||
"framerate", G_TYPE_DOUBLE, smokedec->fps, NULL);
|
|
||||||
|
|
||||||
/* at this point, we're pretty sure that this will be the output
|
|
||||||
* format, so we'll set it. */
|
|
||||||
gst_pad_set_explicit_caps (smokedec->srcpad, srccaps);
|
|
||||||
|
|
||||||
smokecodec_decode_new (&smokedec->info);
|
smokecodec_decode_new (&smokedec->info);
|
||||||
|
|
||||||
return GST_PAD_LINK_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_smokedec_chain (GstPad * pad, GstData * _data)
|
gst_smokedec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = GST_BUFFER (_data);
|
|
||||||
GstSmokeDec *smokedec;
|
GstSmokeDec *smokedec;
|
||||||
guchar *data, *outdata;
|
guint8 *data, *outdata;
|
||||||
gulong size, outsize;
|
gulong size, outsize;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
SmokeCodecFlags flags;
|
SmokeCodecFlags flags;
|
||||||
GstClockTime time;
|
GstClockTime time;
|
||||||
|
guint width, height;
|
||||||
|
guint fps_num, fps_denom;
|
||||||
|
gint smokeret;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
gint width, height;
|
smokedec = GST_SMOKEDEC (gst_pad_get_parent (pad));
|
||||||
gint fps_num, fps_denom;
|
|
||||||
|
|
||||||
smokedec = GST_SMOKEDEC (GST_OBJECT_PARENT (pad));
|
data = GST_BUFFER_DATA (buf);
|
||||||
|
|
||||||
if (!GST_PAD_IS_LINKED (smokedec->srcpad)) {
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = (guchar *) GST_BUFFER_DATA (buf);
|
|
||||||
size = GST_BUFFER_SIZE (buf);
|
size = GST_BUFFER_SIZE (buf);
|
||||||
time = GST_BUFFER_TIMESTAMP (buf);
|
time = GST_BUFFER_TIMESTAMP (buf);
|
||||||
|
|
||||||
GST_DEBUG ("gst_smokedec_chain: got buffer of %ld bytes in '%s'", size,
|
GST_DEBUG_OBJECT (smokedec,
|
||||||
|
"gst_smokedec_chain: got buffer of %ld bytes in '%s'", size,
|
||||||
GST_OBJECT_NAME (smokedec));
|
GST_OBJECT_NAME (smokedec));
|
||||||
|
|
||||||
|
/* have the ID packet. */
|
||||||
if (data[0] == SMOKECODEC_TYPE_ID) {
|
if (data[0] == SMOKECODEC_TYPE_ID) {
|
||||||
smokecodec_parse_id (smokedec->info, data, size);
|
smokeret = smokecodec_parse_id (smokedec->info, data, size);
|
||||||
return;
|
if (smokeret != SMOKECODEC_OK)
|
||||||
|
goto header_error;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG ("gst_smokedec_chain: reading header %08lx", *(gulong *) data);
|
/* now handle data packets */
|
||||||
|
GST_DEBUG_OBJECT (smokedec, "gst_smokedec_chain: reading header %08lx",
|
||||||
|
*(gulong *) data);
|
||||||
smokecodec_parse_header (smokedec->info, data, size, &flags, &width, &height,
|
smokecodec_parse_header (smokedec->info, data, size, &flags, &width, &height,
|
||||||
&fps_num, &fps_denom);
|
&fps_num, &fps_denom);
|
||||||
|
|
||||||
|
if (smokedec->height != height || smokedec->width != width ||
|
||||||
|
smokedec->fps_num != fps_num || smokedec->fps_denom != fps_denom) {
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
smokedec->height = height;
|
||||||
|
smokedec->width = width;
|
||||||
|
|
||||||
|
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||||
|
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||||
|
"width", G_TYPE_INT, width,
|
||||||
|
"height", G_TYPE_INT, height,
|
||||||
|
"framerate", GST_TYPE_FRACTION, fps_num, fps_denom, NULL);
|
||||||
|
|
||||||
|
gst_pad_set_caps (smokedec->srcpad, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (smokedec->need_keyframe) {
|
||||||
|
if (!(flags & SMOKECODEC_KEYFRAME))
|
||||||
|
goto keyframe_skip;
|
||||||
|
|
||||||
|
smokedec->need_keyframe = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
outbuf = gst_buffer_new ();
|
outbuf = gst_buffer_new ();
|
||||||
outsize = GST_BUFFER_SIZE (outbuf) = width * height + width * height / 2;
|
outsize = GST_BUFFER_SIZE (outbuf) = width * height + width * height / 2;
|
||||||
outdata = g_malloc (outsize);
|
outdata = g_malloc (outsize);
|
||||||
|
@ -226,6 +225,7 @@ gst_smokedec_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
GST_BUFFER_DURATION (outbuf) = GST_SECOND * fps_denom / fps_num;
|
GST_BUFFER_DURATION (outbuf) = GST_SECOND * fps_denom / fps_num;
|
||||||
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf);
|
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf);
|
||||||
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (smokedec->srcpad));
|
||||||
|
|
||||||
if (time == GST_CLOCK_TIME_NONE) {
|
if (time == GST_CLOCK_TIME_NONE) {
|
||||||
if (GST_BUFFER_OFFSET (buf) == -1) {
|
if (GST_BUFFER_OFFSET (buf) == -1) {
|
||||||
|
@ -237,35 +237,38 @@ gst_smokedec_chain (GstPad * pad, GstData * _data)
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
GST_BUFFER_TIMESTAMP (outbuf) = time;
|
||||||
smokedec->next_time = time + GST_BUFFER_DURATION (outbuf);
|
smokedec->next_time = time + GST_BUFFER_DURATION (outbuf);
|
||||||
|
|
||||||
if (smokedec->height != height) {
|
smokeret = smokecodec_decode (smokedec->info, data, size, outdata);
|
||||||
GstCaps *caps;
|
if (smokeret != SMOKECODEC_OK)
|
||||||
|
goto decode_error;
|
||||||
|
|
||||||
smokedec->height = height;
|
GST_DEBUG_OBJECT (smokedec, "gst_smokedec_chain: sending buffer");
|
||||||
|
ret = gst_pad_push (smokedec->srcpad, outbuf);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
done:
|
||||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
gst_buffer_unref (buf);
|
||||||
"width", G_TYPE_INT, width,
|
gst_object_unref (smokedec);
|
||||||
"height", G_TYPE_INT, height,
|
|
||||||
"framerate", G_TYPE_DOUBLE, ((double) fps_num) / fps_denom, NULL);
|
return ret;
|
||||||
gst_pad_set_explicit_caps (smokedec->srcpad, caps);
|
|
||||||
gst_caps_free (caps);
|
/* ERRORS */
|
||||||
|
header_error:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (smokedec, STREAM, DECODE,
|
||||||
|
(NULL), ("Could not parse smoke header, reason: %d", smokeret));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
keyframe_skip:
|
||||||
if (smokedec->need_keyframe) {
|
{
|
||||||
if (flags & SMOKECODEC_KEYFRAME) {
|
GST_DEBUG_OBJECT (smokedec, "dropping buffer while waiting for keyframe");
|
||||||
smokedec->need_keyframe = FALSE;
|
ret = GST_FLOW_OK;
|
||||||
} else {
|
goto done;
|
||||||
GST_DEBUG_OBJECT (smokedec, "dropping buffer while waiting for keyframe");
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
decode_error:
|
||||||
if (!smokedec->need_keyframe) {
|
{
|
||||||
smokecodec_decode (smokedec->info, data, size, outdata);
|
GST_ELEMENT_ERROR (smokedec, STREAM, DECODE,
|
||||||
gst_buffer_unref (buf);
|
(NULL), ("Could not decode smoke frame, reason: %d", smokeret));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
GST_DEBUG ("gst_smokedec_chain: sending buffer");
|
goto done;
|
||||||
gst_pad_push (smokedec->srcpad, GST_DATA (outbuf));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,7 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "smokecodec.h"
|
#include "smokecodec.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_SMOKEDEC \
|
#define GST_TYPE_SMOKEDEC \
|
||||||
(gst_smokedec_get_type())
|
(gst_smokedec_get_type())
|
||||||
|
@ -54,7 +51,8 @@ struct _GstSmokeDec {
|
||||||
gint format;
|
gint format;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gdouble fps;
|
gint fps_num;
|
||||||
|
gint fps_denom;
|
||||||
GstClockTime next_time;
|
GstClockTime next_time;
|
||||||
|
|
||||||
SmokeCodecInfo *info;
|
SmokeCodecInfo *info;
|
||||||
|
@ -72,10 +70,6 @@ struct _GstSmokeDecClass {
|
||||||
|
|
||||||
GType gst_smokedec_get_type(void);
|
GType gst_smokedec_get_type(void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_SMOKEDEC_H__ */
|
#endif /* __GST_SMOKEDEC_H__ */
|
||||||
|
|
|
@ -296,6 +296,7 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
guint encsize;
|
guint encsize;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
SmokeCodecFlags flags;
|
SmokeCodecFlags flags;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
smokeenc = GST_SMOKEENC (GST_OBJECT_PARENT (pad));
|
smokeenc = GST_SMOKEENC (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
|
@ -318,7 +319,7 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
|
|
||||||
GST_BUFFER_SIZE (outbuf) = encsize;
|
GST_BUFFER_SIZE (outbuf) = encsize;
|
||||||
|
|
||||||
gst_pad_push (smokeenc->srcpad, outbuf);
|
ret = gst_pad_push (smokeenc->srcpad, outbuf);
|
||||||
|
|
||||||
smokeenc->need_header = FALSE;
|
smokeenc->need_header = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -346,11 +347,11 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
GST_BUFFER_OFFSET (outbuf) = smokeenc->frame;
|
GST_BUFFER_OFFSET (outbuf) = smokeenc->frame;
|
||||||
GST_BUFFER_OFFSET_END (outbuf) = smokeenc->frame + 1;
|
GST_BUFFER_OFFSET_END (outbuf) = smokeenc->frame + 1;
|
||||||
|
|
||||||
gst_pad_push (smokeenc->srcpad, outbuf);
|
ret = gst_pad_push (smokeenc->srcpad, outbuf);
|
||||||
|
|
||||||
smokeenc->frame++;
|
smokeenc->frame++;
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -25,10 +25,7 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include "smokecodec.h"
|
#include "smokecodec.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_SMOKEENC \
|
#define GST_TYPE_SMOKEENC \
|
||||||
(gst_smokeenc_get_type())
|
(gst_smokeenc_get_type())
|
||||||
|
@ -73,10 +70,6 @@ struct _GstSmokeEncClass {
|
||||||
|
|
||||||
GType gst_smokeenc_get_type(void);
|
GType gst_smokeenc_get_type(void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_SMOKEENC_H__ */
|
#endif /* __GST_SMOKEENC_H__ */
|
||||||
|
|
|
@ -61,6 +61,8 @@ int smokecodec_encode_new (SmokeCodecInfo **info,
|
||||||
|
|
||||||
int smokecodec_decode_new (SmokeCodecInfo **info);
|
int smokecodec_decode_new (SmokeCodecInfo **info);
|
||||||
|
|
||||||
|
int smokecodec_info_free (SmokeCodecInfo * info);
|
||||||
|
|
||||||
/* config */
|
/* config */
|
||||||
SmokeCodecResult smokecodec_set_quality (SmokeCodecInfo *info,
|
SmokeCodecResult smokecodec_set_quality (SmokeCodecInfo *info,
|
||||||
const unsigned int min,
|
const unsigned int min,
|
||||||
|
|
Loading…
Reference in a new issue