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:
Wim Taymans 2006-03-03 15:50:40 +00:00
parent e85d1638c3
commit 188bd155cd
14 changed files with 197 additions and 122 deletions

View file

@ -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>
* docs/plugins/Makefile.am:

View file

@ -87,6 +87,10 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/flac/gstflacdec.h \
$(top_srcdir)/ext/hal/gsthalaudiosink.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/multipartdemux.c \
$(top_srcdir)/gst/udp/gstudpsrc.h \

View file

@ -24,11 +24,15 @@
<xi:include href="xml/element-halaudiosink.xml" />
<xi:include href="xml/element-halaudiosrc.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-udpsrc.xml" />
<xi:include href="xml/element-multiudpsink.xml" />
<xi:include href="xml/element-multipartmux.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-videoflip.xml" />
<xi:include href="xml/element-videomixer.xml" />

View file

@ -94,6 +94,64 @@ GstHalAudioSrc
GstHalAudioSrcClass
</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>
<FILE>element-id3demux</FILE>
GstID3Demux

View file

@ -39,6 +39,7 @@ GObject
GstPngEnc
GstJpegEnc
GstJpegDec
GstSmokeDec
GstSmokeEnc
GstFlacEnc
GstFlacDec

View file

@ -5,9 +5,8 @@ libgstjpeg_la_SOURCES = \
gstjpegenc.c \
gstjpegdec.c \
gstsmokeenc.c \
smokecodec.c
# gstsmokedec.c
smokecodec.c \
gstsmokedec.c
libgstjpeg_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstjpeg_la_LIBADD = $(GST_LIBS) $(JPEG_LIBS)

View file

@ -27,11 +27,11 @@
#include "gstjpegdec.h"
#include "gstjpegenc.h"
#include "gstsmokeenc.h"
/*
#include "gstsmokedec.h"
#if 0
static GstStaticCaps smoke_caps = GST_STATIC_CAPS ("video/x-smoke");
#define SMOKE_CAPS (gst_static_caps_get(&smoke_caps))
static void
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);
}
}
*/
#endif
static gboolean
plugin_init (GstPlugin * plugin)
@ -63,15 +63,16 @@ plugin_init (GstPlugin * plugin)
if (!gst_element_register (plugin, "smokeenc", GST_RANK_PRIMARY,
GST_TYPE_SMOKEENC))
return FALSE;
/*
if (!gst_element_register (plugin, "smokedec", GST_RANK_PRIMARY,
GST_TYPE_SMOKEDEC))
return FALSE;
return FALSE;
#if 0
if (!gst_type_find_register (plugin, "video/x-smoke", GST_RANK_PRIMARY,
smoke_type_find, NULL, SMOKE_CAPS, NULL))
return FALSE;
*/
#endif
return TRUE;
}

View file

@ -828,8 +828,8 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
GstClockTime next_ts;
dec->frames_decoded++;
next_ts = dec->frames_decoded * GST_SECOND *
dec->framerate_denominator / dec->framerate_numerator;
next_ts = gst_util_uint64_scale (dec->frames_decoded,
GST_SECOND * dec->framerate_denominator, dec->framerate_numerator);
duration = next_ts - dec->next_ts;
dec->next_ts = next_ts;

View file

@ -29,10 +29,7 @@
#endif
#include <jpeglib.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GST_TYPE_JPEGENC \
(gst_jpegenc_get_type())
@ -82,10 +79,6 @@ struct _GstJpegEncClass {
GType gst_jpegenc_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_JPEGENC_H__ */

View file

@ -41,22 +41,19 @@ GST_DEBUG_CATEGORY (smokedec_debug);
/* SmokeDec signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0
/* FILL ME */
PROP_0
};
static void gst_smokedec_base_init (gpointer g_class);
static void gst_smokedec_class_init (GstSmokeDec * klass);
static void gst_smokedec_init (GstSmokeDec * smokedec);
static void gst_smokedec_chain (GstPad * pad, GstData * _data);
static GstPadLinkReturn gst_smokedec_link (GstPad * pad, const GstCaps * caps);
static GstFlowReturn gst_smokedec_chain (GstPad * pad, GstBuffer * buf);
static GstElementClass *parent_class = NULL;
@ -100,7 +97,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-smoke, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
"height = (int) [ 16, 4096 ], " "framerate = (fraction) [ 0/1, MAX ]")
);
static void
@ -130,94 +127,96 @@ gst_smokedec_class_init (GstSmokeDec * klass)
static void
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 */
smokedec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&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_link_function (smokedec->sinkpad, gst_smokedec_link);
gst_element_add_pad (GST_ELEMENT (smokedec), smokedec->sinkpad);
smokedec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&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);
/* reset the initial video state */
smokedec->format = -1;
smokedec->width = -1;
smokedec->height = -1;
smokedec->fps_num = -1;
smokedec->fps_denom = -1;
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);
return GST_PAD_LINK_OK;
}
static void
gst_smokedec_chain (GstPad * pad, GstData * _data)
static GstFlowReturn
gst_smokedec_chain (GstPad * pad, GstBuffer * buf)
{
GstBuffer *buf = GST_BUFFER (_data);
GstSmokeDec *smokedec;
guchar *data, *outdata;
guint8 *data, *outdata;
gulong size, outsize;
GstBuffer *outbuf;
SmokeCodecFlags flags;
GstClockTime time;
guint width, height;
guint fps_num, fps_denom;
gint smokeret;
GstFlowReturn ret;
gint width, height;
gint fps_num, fps_denom;
smokedec = GST_SMOKEDEC (gst_pad_get_parent (pad));
smokedec = GST_SMOKEDEC (GST_OBJECT_PARENT (pad));
if (!GST_PAD_IS_LINKED (smokedec->srcpad)) {
gst_buffer_unref (buf);
return;
}
data = (guchar *) GST_BUFFER_DATA (buf);
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (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));
/* have the ID packet. */
if (data[0] == SMOKECODEC_TYPE_ID) {
smokecodec_parse_id (smokedec->info, data, size);
return;
smokeret = smokecodec_parse_id (smokedec->info, data, size);
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,
&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 ();
outsize = GST_BUFFER_SIZE (outbuf) = width * height + width * height / 2;
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_OFFSET (outbuf) = GST_BUFFER_OFFSET (buf);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (smokedec->srcpad));
if (time == GST_CLOCK_TIME_NONE) {
if (GST_BUFFER_OFFSET (buf) == -1) {
@ -237,35 +237,38 @@ gst_smokedec_chain (GstPad * pad, GstData * _data)
GST_BUFFER_TIMESTAMP (outbuf) = time;
smokedec->next_time = time + GST_BUFFER_DURATION (outbuf);
if (smokedec->height != height) {
GstCaps *caps;
smokeret = smokecodec_decode (smokedec->info, data, size, outdata);
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",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, ((double) fps_num) / fps_denom, NULL);
gst_pad_set_explicit_caps (smokedec->srcpad, caps);
gst_caps_free (caps);
done:
gst_buffer_unref (buf);
gst_object_unref (smokedec);
return ret;
/* ERRORS */
header_error:
{
GST_ELEMENT_ERROR (smokedec, STREAM, DECODE,
(NULL), ("Could not parse smoke header, reason: %d", smokeret));
ret = GST_FLOW_ERROR;
goto done;
}
if (smokedec->need_keyframe) {
if (flags & SMOKECODEC_KEYFRAME) {
smokedec->need_keyframe = FALSE;
} else {
GST_DEBUG_OBJECT (smokedec, "dropping buffer while waiting for keyframe");
gst_buffer_unref (buf);
return;
}
keyframe_skip:
{
GST_DEBUG_OBJECT (smokedec, "dropping buffer while waiting for keyframe");
ret = GST_FLOW_OK;
goto done;
}
if (!smokedec->need_keyframe) {
smokecodec_decode (smokedec->info, data, size, outdata);
gst_buffer_unref (buf);
GST_DEBUG ("gst_smokedec_chain: sending buffer");
gst_pad_push (smokedec->srcpad, GST_DATA (outbuf));
decode_error:
{
GST_ELEMENT_ERROR (smokedec, STREAM, DECODE,
(NULL), ("Could not decode smoke frame, reason: %d", smokeret));
ret = GST_FLOW_ERROR;
goto done;
}
}

View file

@ -25,10 +25,7 @@
#include <gst/gst.h>
#include "smokecodec.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GST_TYPE_SMOKEDEC \
(gst_smokedec_get_type())
@ -54,7 +51,8 @@ struct _GstSmokeDec {
gint format;
gint width;
gint height;
gdouble fps;
gint fps_num;
gint fps_denom;
GstClockTime next_time;
SmokeCodecInfo *info;
@ -72,10 +70,6 @@ struct _GstSmokeDecClass {
GType gst_smokedec_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_SMOKEDEC_H__ */

View file

@ -296,6 +296,7 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
guint encsize;
GstBuffer *outbuf;
SmokeCodecFlags flags;
GstFlowReturn ret;
smokeenc = GST_SMOKEENC (GST_OBJECT_PARENT (pad));
@ -318,7 +319,7 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
GST_BUFFER_SIZE (outbuf) = encsize;
gst_pad_push (smokeenc->srcpad, outbuf);
ret = gst_pad_push (smokeenc->srcpad, outbuf);
smokeenc->need_header = FALSE;
}
@ -346,11 +347,11 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
GST_BUFFER_OFFSET (outbuf) = smokeenc->frame;
GST_BUFFER_OFFSET_END (outbuf) = smokeenc->frame + 1;
gst_pad_push (smokeenc->srcpad, outbuf);
ret = gst_pad_push (smokeenc->srcpad, outbuf);
smokeenc->frame++;
return GST_FLOW_OK;
return ret;
}
static void

View file

@ -25,10 +25,7 @@
#include <gst/gst.h>
#include "smokecodec.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GST_TYPE_SMOKEENC \
(gst_smokeenc_get_type())
@ -73,10 +70,6 @@ struct _GstSmokeEncClass {
GType gst_smokeenc_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_SMOKEENC_H__ */

View file

@ -61,6 +61,8 @@ int smokecodec_encode_new (SmokeCodecInfo **info,
int smokecodec_decode_new (SmokeCodecInfo **info);
int smokecodec_info_free (SmokeCodecInfo * info);
/* config */
SmokeCodecResult smokecodec_set_quality (SmokeCodecInfo *info,
const unsigned int min,