docs/plugins/: Added dvdec and dvdemux to 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:
Added dvdec and dvdemux to docs.

* ext/dv/gstdvdec.c: (gst_dvdec_base_init), (gst_dvdec_chain):
Added docs.
Check frame sizes so we don't crash when don't have enough
data.
Send nice error messages on error.

* ext/dv/gstdvdemux.c: (gst_dvdemux_base_init),
(gst_dvdemux_class_init), (gst_dvdemux_init),
(gst_dvdemux_finalize), (gst_dvdemux_reset),
(gst_dvdemux_src_convert), (gst_dvdemux_sink_convert),
(gst_dvdemux_src_query), (gst_dvdemux_sink_query),
(gst_dvdemux_push_event), (gst_dvdemux_handle_sink_event),
(gst_dvdemux_convert_src_pair), (gst_dvdemux_convert_sink_pair),
(gst_dvdemux_convert_src_to_sink), (gst_dvdemux_handle_push_seek),
(gst_dvdemux_do_seek), (gst_dvdemux_handle_pull_seek),
(gst_dvdemux_handle_src_event), (gst_dvdemux_demux_audio),
(gst_dvdemux_demux_video), (gst_dvdemux_demux_frame),
(gst_dvdemux_flush), (gst_dvdemux_chain), (gst_dvdemux_loop),
(gst_dvdemux_sink_activate_push), (gst_dvdemux_sink_activate_pull),
(gst_dvdemux_sink_activate), (gst_dvdemux_change_state):
* ext/dv/gstdvdemux.h:
Added docs.
Implement pull mode.
Fix memleaks.
Reduce memcpy for the video demuxing.
This commit is contained in:
Wim Taymans 2006-02-28 10:22:11 +00:00
parent 86ddc6d513
commit e6d71f7bea
7 changed files with 849 additions and 215 deletions

View file

@ -1,3 +1,36 @@
2006-02-28 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:
Added dvdec and dvdemux to docs.
* ext/dv/gstdvdec.c: (gst_dvdec_base_init), (gst_dvdec_chain):
Added docs.
Check frame sizes so we don't crash when don't have enough
data.
Send nice error messages on error.
* ext/dv/gstdvdemux.c: (gst_dvdemux_base_init),
(gst_dvdemux_class_init), (gst_dvdemux_init),
(gst_dvdemux_finalize), (gst_dvdemux_reset),
(gst_dvdemux_src_convert), (gst_dvdemux_sink_convert),
(gst_dvdemux_src_query), (gst_dvdemux_sink_query),
(gst_dvdemux_push_event), (gst_dvdemux_handle_sink_event),
(gst_dvdemux_convert_src_pair), (gst_dvdemux_convert_sink_pair),
(gst_dvdemux_convert_src_to_sink), (gst_dvdemux_handle_push_seek),
(gst_dvdemux_do_seek), (gst_dvdemux_handle_pull_seek),
(gst_dvdemux_handle_src_event), (gst_dvdemux_demux_audio),
(gst_dvdemux_demux_video), (gst_dvdemux_demux_frame),
(gst_dvdemux_flush), (gst_dvdemux_chain), (gst_dvdemux_loop),
(gst_dvdemux_sink_activate_push), (gst_dvdemux_sink_activate_pull),
(gst_dvdemux_sink_activate), (gst_dvdemux_change_state):
* ext/dv/gstdvdemux.h:
Added docs.
Implement pull mode.
Fix memleaks.
Reduce memcpy for the video demuxing.
2006-02-28 Jan Schmidt <thaytan@mad.scientist.com> 2006-02-28 Jan Schmidt <thaytan@mad.scientist.com>
* ext/annodex/gstcmmldec.c: (gst_cmml_dec_sink_event), * ext/annodex/gstcmmldec.c: (gst_cmml_dec_sink_event),

View file

@ -82,6 +82,8 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/id3demux/gstid3demux.h \ $(top_srcdir)/gst/id3demux/gstid3demux.h \
$(top_srcdir)/ext/cairo/gsttimeoverlay.h \ $(top_srcdir)/ext/cairo/gsttimeoverlay.h \
$(top_srcdir)/ext/cdio/gstcdiocddasrc.h \ $(top_srcdir)/ext/cdio/gstcdiocddasrc.h \
$(top_srcdir)/ext/dv/gstdvdec.h \
$(top_srcdir)/ext/dv/gstdvdemux.h \
$(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 \

View file

@ -17,6 +17,8 @@
<xi:include href="xml/element-autovideosink.xml" /> <xi:include href="xml/element-autovideosink.xml" />
<xi:include href="xml/element-cairotimeoverlay.xml" /> <xi:include href="xml/element-cairotimeoverlay.xml" />
<xi:include href="xml/element-cdiocddasrc.xml" /> <xi:include href="xml/element-cdiocddasrc.xml" />
<xi:include href="xml/element-dvdec.xml" />
<xi:include href="xml/element-dvdemux.xml" />
<xi:include href="xml/element-flacdec.xml" /> <xi:include href="xml/element-flacdec.xml" />
<xi:include href="xml/element-goom.xml" /> <xi:include href="xml/element-goom.xml" />
<xi:include href="xml/element-halaudiosink.xml" /> <xi:include href="xml/element-halaudiosink.xml" />

View file

@ -46,6 +46,22 @@ GstCdioCddaSrc
GstCdioCddaSrcClass GstCdioCddaSrcClass
</SECTION> </SECTION>
<SECTION>
<FILE>element-dvdec</FILE>
GstDVDec
<TITLE>dvdec</TITLE>
<SUBSECTION Standard>
GstDVDecClass
</SECTION>
<SECTION>
<FILE>element-dvdemux</FILE>
GstDVDemux
<TITLE>dvdemux</TITLE>
<SUBSECTION Standard>
GstDVDemuxClass
</SECTION>
<SECTION> <SECTION>
<FILE>element-flacdec</FILE> <FILE>element-flacdec</FILE>
GstFlacDec GstFlacDec

View file

@ -18,6 +18,30 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
/**
* SECTION:element-dvdec
*
* <refsect2>
* <para>
* dvdec decodes DV video into raw video. The element expects a full DV frame
* as input, which is 120000 bytes for NTSC and 144000 for PAL video.
* </para>
* <para>
* This element can perform simple frame dropping with the drop-factor
* property. Setting this property to a value N > 1 will only decode every
* Nth frame.
* </para>
* <title>Example launch line</title>
* <para>
* <programlisting>
* gst-launch filesrc location=test.dv ! dvdemux name=demux ! dvdec ! xvimagesink
* </programlisting>
* This pipeline decodes and renders the raw DV stream to a videosink.
* </para>
* Last reviewed on 2006-02-28 (0.10.3)
* </refsect2>
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
@ -33,6 +57,9 @@ GST_ELEMENT_DETAILS ("DV (smpte314) decoder plugin",
"Uses libdv to decode DV video (libdv.sourceforge.net)", "Uses libdv to decode DV video (libdv.sourceforge.net)",
"Erik Walthinsen <omega@cse.ogi.edu>," "Wim Taymans <wim@fluendo.com>"); "Erik Walthinsen <omega@cse.ogi.edu>," "Wim Taymans <wim@fluendo.com>");
/* sizes of one input buffer */
#define NTSC_BUFFER 120000
#define PAL_BUFFER 144000
#define DV_DEFAULT_QUALITY DV_QUALITY_BEST #define DV_DEFAULT_QUALITY DV_QUALITY_BEST
#define DV_DEFAULT_DECODE_NTH 1 #define DV_DEFAULT_DECODE_NTH 1
@ -265,12 +292,25 @@ gst_dvdec_chain (GstPad * pad, GstBuffer * buf)
gint outframe_pitches[3]; gint outframe_pitches[3];
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
guint length;
dvdec = GST_DVDEC (gst_pad_get_parent (pad)); dvdec = GST_DVDEC (gst_pad_get_parent (pad));
inframe = GST_BUFFER_DATA (buf); inframe = GST_BUFFER_DATA (buf);
if (dv_parse_header (dvdec->decoder, inframe) < 0) /* buffer should be at least the size of one NTSC frame, this should
g_assert_not_reached (); * be enough to decode the header. */
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < NTSC_BUFFER))
goto wrong_size;
if (G_UNLIKELY (dv_parse_header (dvdec->decoder, inframe) < 0))
goto parse_header_error;
/* check the buffer is of right size after we know if we are
* dealing with PAL or NTSC */
length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < length))
goto wrong_size;
dv_parse_packs (dvdec->decoder, inframe); dv_parse_packs (dvdec->decoder, inframe);
if (dvdec->video_offset % dvdec->drop_factor != 0) if (dvdec->video_offset % dvdec->drop_factor != 0)
@ -280,7 +320,7 @@ gst_dvdec_chain (GstPad * pad, GstBuffer * buf)
gst_pad_alloc_buffer_and_set_caps (dvdec->srcpad, 0, gst_pad_alloc_buffer_and_set_caps (dvdec->srcpad, 0,
(720 * dvdec->height) * dvdec->bpp, (720 * dvdec->height) * dvdec->bpp,
GST_PAD_CAPS (dvdec->srcpad), &outbuf); GST_PAD_CAPS (dvdec->srcpad), &outbuf);
if (ret != GST_FLOW_OK) if (G_UNLIKELY (ret != GST_FLOW_OK))
goto no_buffer; goto no_buffer;
outframe = GST_BUFFER_DATA (outbuf); outframe = GST_BUFFER_DATA (outbuf);
@ -306,19 +346,33 @@ gst_dvdec_chain (GstPad * pad, GstBuffer * buf)
ret = gst_pad_push (dvdec->srcpad, outbuf); ret = gst_pad_push (dvdec->srcpad, outbuf);
skip: skip:
gst_buffer_unref (buf);
dvdec->video_offset++; dvdec->video_offset++;
done:
gst_buffer_unref (buf);
gst_object_unref (dvdec); gst_object_unref (dvdec);
return ret; return ret;
/* ERRORS */ /* ERRORS */
wrong_size:
{
GST_ELEMENT_ERROR (dvdec, STREAM, DECODE,
(NULL), ("Input buffer too small"));
ret = GST_FLOW_ERROR;
goto done;
}
parse_header_error:
{
GST_ELEMENT_ERROR (dvdec, STREAM, DECODE,
(NULL), ("Error parsing DV header"));
ret = GST_FLOW_ERROR;
goto done;
}
no_buffer: no_buffer:
{ {
GST_DEBUG_OBJECT (dvdec, "could not allocate buffer"); GST_DEBUG_OBJECT (dvdec, "could not allocate buffer");
gst_buffer_unref (buf); goto done;
gst_object_unref (dvdec);
return ret;
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,9 @@ G_BEGIN_DECLS
typedef struct _GstDVDemux GstDVDemux; typedef struct _GstDVDemux GstDVDemux;
typedef struct _GstDVDemuxClass GstDVDemuxClass; typedef struct _GstDVDemuxClass GstDVDemuxClass;
typedef gboolean (*GstDVDemuxSeekHandler) (GstDVDemux *demux, GstPad * pad, GstEvent * event);
struct _GstDVDemux { struct _GstDVDemux {
GstElement element; GstElement element;
@ -67,14 +70,14 @@ struct _GstDVDemux {
gint framecount; gint framecount;
guint64 timestamp; gint64 frame_offset;
guint64 duration; gint64 audio_offset;
gint64 total_frames; gint64 video_offset;
guint64 audio_offset;
guint64 video_offset;
GstDVDemuxSeekHandler seek_handler;
GstSegment byte_segment; GstSegment byte_segment;
GstSegment time_segment; GstSegment time_segment;
gboolean running;
gboolean need_segment; gboolean need_segment;
gboolean new_media; gboolean new_media;