AUTHORS: Add me to the authors file

Original commit message from CVS:
* AUTHORS:
Add me to the authors file
* configure.ac:
Increase the libdv requirement to >= version 0.100
* ext/dv/gstdvdec.c: (gst_dvdec_init), (gst_dvdec_src_convert),
(gst_dvdec_src_query), (gst_dvdec_handle_sink_event),
(gst_dvdec_push), (gst_dvdec_loop), (gst_dvdec_change_state):
* ext/dv/gstdvdec.h:
Add support for the new_media flag when sending DISCONT events
Make the querying work when video pad is not linked
This commit is contained in:
Jan Schmidt 2004-06-07 12:01:52 +00:00
parent 58bfb00622
commit 192579e18b
5 changed files with 76 additions and 29 deletions

View File

@ -17,3 +17,4 @@ David Schleef <ds@schleef.org>
Benjamin Otte <in7y118@public.uni-hamburg.de> Benjamin Otte <in7y118@public.uni-hamburg.de>
Ronald Bultje <rbultje@ronald.bitfreak.net> Ronald Bultje <rbultje@ronald.bitfreak.net>
Julien MOUTTE <julien@moutte.net> Julien MOUTTE <julien@moutte.net>
Jan Schmidt <thaytan@mad.scientist.com>

View File

@ -1,3 +1,15 @@
2004-06-07 Jan Schmidt <thaytan@mad.scientist.com>
* AUTHORS:
Add me to the authors file
* configure.ac:
Increase the libdv requirement to >= version 0.100
* ext/dv/gstdvdec.c: (gst_dvdec_init), (gst_dvdec_src_convert),
(gst_dvdec_src_query), (gst_dvdec_handle_sink_event),
(gst_dvdec_push), (gst_dvdec_loop), (gst_dvdec_change_state):
* ext/dv/gstdvdec.h:
Add support for the new_media flag when sending DISCONT events
Make the querying work when video pad is not linked
2004-06-07 Tim-Philipp Müller <t.i.m@zen.co.uk> 2004-06-07 Tim-Philipp Müller <t.i.m@zen.co.uk>
reviewed by Benjamin Otte <otte@gnome.org> reviewed by Benjamin Otte <otte@gnome.org>

View File

@ -1157,7 +1157,7 @@ GST_CHECK_FEATURE(LCS, Lcs, lcs, [
dnl *** libdv *** dnl *** libdv ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBDV, true) translit(dnm, m, l) AM_CONDITIONAL(USE_LIBDV, true)
GST_CHECK_FEATURE(LIBDV, [libdv DV/video decoder], dvdec, [ GST_CHECK_FEATURE(LIBDV, [libdv DV/video decoder], dvdec, [
PKG_CHECK_MODULES(LIBDV, libdv >= 0.98, HAVE_LIBDV="yes", HAVE_LIBDV="no") PKG_CHECK_MODULES(LIBDV, libdv >= 0.100, HAVE_LIBDV="yes", HAVE_LIBDV="no")
AC_SUBST(LIBDV_CFLAGS) AC_SUBST(LIBDV_CFLAGS)
AC_SUBST(LIBDV_LIBS) AC_SUBST(LIBDV_LIBS)
]) ])
@ -1499,11 +1499,16 @@ GST_CHECK_FEATURE(OGG, [ogg de/encoder], oggdemux oggmux, [
]) ])
dnl *** theora *** dnl *** theora ***
dnl FIXME: theora doesn't have proper pc/m4 files yet, change this when this happens
translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true) translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true)
GST_CHECK_FEATURE(THEORA, [ogg theora codec], theoradec, [ GST_CHECK_FEATURE(THEORA, [ogg theora codec], theoradec, [
GST_CHECK_LIBHEADER(THEORA, theora, theora_version_string, , theora/theora.h, THEORA_LIBS="-ltheora") PKG_CHECK_MODULES(THEORA, theora, [
AC_SUBST(THEORA_LIBS) HAVE_THEORA="yes"
AC_SUBST(THEORA_LIBS)
AC_SUBST(THEORA_CFLAGS)
], [
GST_CHECK_LIBHEADER(THEORA, theora, theora_version_string, , theora/theora.h, THEORA_LIBS="-ltheora")
AC_SUBST(THEORA_LIBS)
])
]) ])
dnl *** vorbis *** dnl *** vorbis ***

View File

@ -356,10 +356,12 @@ gst_dvdec_init (GstDVDec * dvdec)
gst_element_set_loop_function (GST_ELEMENT (dvdec), gst_dvdec_loop); gst_element_set_loop_function (GST_ELEMENT (dvdec), gst_dvdec_loop);
dvdec->bs = NULL;
dvdec->length = 0; dvdec->length = 0;
dvdec->next_ts = 0LL; dvdec->next_ts = 0LL;
dvdec->end_position = -1LL; dvdec->end_position = -1LL;
dvdec->need_discont = FALSE; dvdec->need_discont = FALSE;
dvdec->new_media = FALSE;
dvdec->framerate = 0; dvdec->framerate = 0;
dvdec->height = 0; dvdec->height = 0;
dvdec->frequency = 0; dvdec->frequency = 0;
@ -403,7 +405,6 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
GstDVDec *dvdec; GstDVDec *dvdec;
dvdec = GST_DVDEC (gst_pad_get_parent (pad)); dvdec = GST_DVDEC (gst_pad_get_parent (pad));
if (dvdec->length == 0) if (dvdec->length == 0)
return FALSE; return FALSE;
@ -425,8 +426,7 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
GST_SECOND); GST_SECOND);
else if (pad == dvdec->audiosrcpad) else if (pad == dvdec->audiosrcpad)
*dest_value = src_value * GST_SECOND / *dest_value = src_value * GST_SECOND /
(2 * dvdec->decoder->audio->frequency * (2 * dvdec->frequency * dvdec->channels);
dvdec->decoder->audio->num_channels);
break; break;
default: default:
res = FALSE; res = FALSE;
@ -439,8 +439,8 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
*dest_value = src_value * 720 * dvdec->height * dvdec->bpp * *dest_value = src_value * 720 * dvdec->height * dvdec->bpp *
dvdec->framerate / GST_SECOND; dvdec->framerate / GST_SECOND;
else if (pad == dvdec->audiosrcpad) else if (pad == dvdec->audiosrcpad)
*dest_value = 2 * src_value * dvdec->decoder->audio->frequency * *dest_value = 2 * src_value * dvdec->frequency *
dvdec->decoder->audio->num_channels / GST_SECOND; dvdec->channels / GST_SECOND;
break; break;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
@ -546,6 +546,9 @@ gst_dvdec_src_query (GstPad * pad, GstQueryType type,
guint64 len; guint64 len;
GstFormat tmp_format; GstFormat tmp_format;
if (!dvdec->bs)
return FALSE;
len = gst_bytestream_length (dvdec->bs); len = gst_bytestream_length (dvdec->bs);
tmp_format = GST_FORMAT_TIME; tmp_format = GST_FORMAT_TIME;
if (len == -1 || !gst_pad_convert (dvdec->sinkpad, if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
@ -605,6 +608,18 @@ gst_dvdec_handle_sink_event (GstDVDec * dvdec)
switch (type) { switch (type) {
case GST_EVENT_FLUSH: case GST_EVENT_FLUSH:
case GST_EVENT_EOS:
case GST_EVENT_FILLER:
/* Forward the event to output sinks */
if (GST_PAD_IS_LINKED (dvdec->videosrcpad)) {
gst_event_ref (event);
gst_pad_push (dvdec->videosrcpad, GST_DATA (event));
}
if (GST_PAD_IS_LINKED (dvdec->audiosrcpad)) {
gst_event_ref (event);
gst_pad_push (dvdec->audiosrcpad, GST_DATA (event));
}
gst_event_unref (event);
break; break;
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_DISCONTINUOUS:
{ {
@ -784,10 +799,12 @@ gst_dvdec_push (GstDVDec * dvdec, GstBuffer * outbuf, GstPad * pad,
{ {
GST_BUFFER_TIMESTAMP (outbuf) = ts; GST_BUFFER_TIMESTAMP (outbuf) = ts;
if (dvdec->need_discont) { if ((dvdec->need_discont) || (dvdec->new_media)) {
GstEvent *discont; GstEvent *discont;
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, ts, NULL); discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, ts, NULL);
GST_EVENT_DISCONT_NEW_MEDIA (discont) = dvdec->new_media;
gst_pad_push (pad, GST_DATA (discont)); gst_pad_push (pad, GST_DATA (discont));
} }
@ -858,6 +875,8 @@ gst_dvdec_loop (GstElement * element)
dvdec->next_ts += GST_SECOND / dvdec->framerate; dvdec->next_ts += GST_SECOND / dvdec->framerate;
dv_parse_packs (dvdec->decoder, GST_BUFFER_DATA (buf)); dv_parse_packs (dvdec->decoder, GST_BUFFER_DATA (buf));
if (dv_is_new_recording (dvdec->decoder, GST_BUFFER_DATA (buf)))
dvdec->new_media = TRUE;
if (GST_PAD_IS_LINKED (dvdec->audiosrcpad)) { if (GST_PAD_IS_LINKED (dvdec->audiosrcpad)) {
gint16 *a_ptr; gint16 *a_ptr;
@ -866,38 +885,44 @@ gst_dvdec_loop (GstElement * element)
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf), dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf),
dvdec->audio_buffers); dvdec->audio_buffers);
if ((dvdec->decoder->audio->frequency != dvdec->frequency) || if ((dv_get_frequency (dvdec->decoder) != dvdec->frequency) ||
(dvdec->decoder->audio->num_channels != dvdec->channels)) { (dv_get_num_channels (dvdec->decoder) != dvdec->channels)) {
if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad, if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad,
gst_caps_new_simple ("audio/x-raw-int", gst_caps_new_simple ("audio/x-raw-int",
"rate", G_TYPE_INT, dvdec->decoder->audio->frequency, "rate", G_TYPE_INT, dv_get_frequency (dvdec->decoder),
"depth", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16,
"width", G_TYPE_INT, 16, "width", G_TYPE_INT, 16,
"signed", G_TYPE_BOOLEAN, TRUE, "signed", G_TYPE_BOOLEAN, TRUE,
"channels", G_TYPE_INT, dvdec->decoder->audio->num_channels, "channels", G_TYPE_INT, dv_get_num_channels (dvdec->decoder),
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) { "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
gst_buffer_unref (buf); gst_buffer_unref (buf);
GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL),
("Failed to negotiate audio parameters for the DV audio stream"));
return; return;
} }
dvdec->frequency = dvdec->decoder->audio->frequency; dvdec->frequency = dv_get_frequency (dvdec->decoder);
dvdec->channels = dvdec->decoder->audio->num_channels; dvdec->channels = dv_get_num_channels (dvdec->decoder);
} }
outbuf = gst_buffer_new (); if (dv_get_num_samples (dvdec->decoder) > 0) {
GST_BUFFER_SIZE (outbuf) = dvdec->decoder->audio->samples_this_frame * outbuf = gst_buffer_new ();
sizeof (gint16) * dvdec->decoder->audio->num_channels; GST_BUFFER_SIZE (outbuf) = dv_get_num_samples (dvdec->decoder) *
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf)); sizeof (gint16) * dv_get_num_channels (dvdec->decoder);
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf); a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < dvdec->decoder->audio->samples_this_frame; i++) { for (i = 0; i < dv_get_num_samples (dvdec->decoder); i++) {
for (j = 0; j < dvdec->decoder->audio->num_channels; j++) { for (j = 0; j < dv_get_num_channels (dvdec->decoder); j++) {
*(a_ptr++) = dvdec->audio_buffers[j][i]; *(a_ptr++) = dvdec->audio_buffers[j][i];
}
} }
gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts);
} }
gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts); } else {
dvdec->frequency = dv_get_frequency (dvdec->decoder);
dvdec->channels = dv_get_num_channels (dvdec->decoder);
} }
if (GST_PAD_IS_LINKED (dvdec->videosrcpad)) { if (GST_PAD_IS_LINKED (dvdec->videosrcpad)) {
@ -935,6 +960,9 @@ gst_dvdec_loop (GstElement * element)
dvdec->space, outframe_ptrs, outframe_pitches); dvdec->space, outframe_ptrs, outframe_pitches);
gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts); gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts);
} else {
dvdec->height = height;
dvdec->framerate = fps;
} }
if ((dvdec->end_position != -1) && if ((dvdec->end_position != -1) &&
@ -942,9 +970,8 @@ gst_dvdec_loop (GstElement * element)
gst_element_set_eos (GST_ELEMENT (dvdec)); gst_element_set_eos (GST_ELEMENT (dvdec));
} }
if (dvdec->need_discont) { dvdec->need_discont = FALSE;
dvdec->need_discont = FALSE; dvdec->new_media = FALSE;
}
gst_buffer_unref (buf); gst_buffer_unref (buf);
} }
@ -977,6 +1004,7 @@ gst_dvdec_change_state (GstElement * element)
dvdec->decoder = NULL; dvdec->decoder = NULL;
dvdec->found_header = FALSE; dvdec->found_header = FALSE;
gst_bytestream_destroy (dvdec->bs); gst_bytestream_destroy (dvdec->bs);
dvdec->bs = NULL;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:
break; break;

View File

@ -66,6 +66,7 @@ struct _GstDVDec {
guint64 next_ts; guint64 next_ts;
guint64 end_position; guint64 end_position;
gboolean need_discont; gboolean need_discont;
gboolean new_media;
gboolean loop; gboolean loop;
gboolean found_header; gboolean found_header;