ext/dv/gstdvdec.c: Fix format conversion and position querying.

Original commit message from CVS:
* ext/dv/gstdvdec.c: (gst_dvdec_init), (gst_dvdec_get_formats),
(gst_dvdec_src_convert), (gst_dvdec_sink_convert):
Fix format conversion and position querying.
* gst/debug/progressreport.c: (gst_progressreport_report):
Don't output a bogus total value that we didn't query.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support):
Always set XV_AUTOPAINT_COLORKEY to true. Fixes xvimagesink showing
only a blank window after xine has been used.
This commit is contained in:
Jan Schmidt 2004-05-21 13:28:24 +00:00
parent dcc87f1efd
commit 4d97abb272
3 changed files with 50 additions and 14 deletions

View file

@ -1,3 +1,14 @@
2004-05-21 Jan Schmidt <thaytan@mad.scientist.com>
* ext/dv/gstdvdec.c: (gst_dvdec_init), (gst_dvdec_get_formats),
(gst_dvdec_src_convert), (gst_dvdec_sink_convert):
Fix format conversion and position querying.
* gst/debug/progressreport.c: (gst_progressreport_report):
Don't output a bogus total value that we didn't query.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support):
Always set XV_AUTOPAINT_COLORKEY to true. Fixes xvimagesink showing
only a blank window after xine has been used.
2004-05-21 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* m4/as-arts.m4:

View file

@ -308,12 +308,12 @@ gst_dvdec_init (GstDVDec * dvdec)
dvdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_temp),
"sink");
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
gst_pad_set_query_function (dvdec->sinkpad, NULL);
gst_pad_set_convert_function (dvdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_dvdec_sink_convert));
gst_pad_set_formats_function (dvdec->sinkpad,
GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
dvdec->videosrcpad =
gst_pad_new_from_template (gst_static_pad_template_get (&video_src_temp),
@ -388,6 +388,7 @@ gst_dvdec_get_formats (GstPad * pad)
static const GstFormat sink_formats[] = {
GST_FORMAT_BYTES,
GST_FORMAT_TIME,
GST_FORMAT_DEFAULT,
0
};
@ -400,7 +401,6 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
{
gboolean res = TRUE;
GstDVDec *dvdec;
gint scale = 1;
dvdec = GST_DVDEC (gst_pad_get_parent (pad));
@ -413,7 +413,21 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value;
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_TIME:
*dest_format = GST_FORMAT_TIME;
if (pad == dvdec->videosrcpad)
*dest_value = src_value * GST_SECOND /
(720 * dvdec->height * dvdec->bpp * dvdec->framerate /
GST_SECOND);
else if (pad == dvdec->audiosrcpad)
*dest_value = src_value * GST_SECOND /
(2 * dvdec->decoder->audio->frequency *
dvdec->decoder->audio->num_channels);
break;
default:
res = FALSE;
}
@ -422,18 +436,16 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
switch (*dest_format) {
case GST_FORMAT_BYTES:
if (pad == dvdec->videosrcpad)
scale = 720 * dvdec->height * dvdec->bpp;
*dest_value = src_value * 720 * dvdec->height * dvdec->bpp *
dvdec->framerate / GST_SECOND;
else if (pad == dvdec->audiosrcpad)
scale = dvdec->decoder->audio->num_channels * 2;
/* fallthrough */
*dest_value = 2 * src_value * dvdec->decoder->audio->frequency *
dvdec->decoder->audio->num_channels / GST_SECOND;
break;
case GST_FORMAT_TIME:
case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_TIME;
if (pad == dvdec->videosrcpad)
*dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
else if (pad == dvdec->audiosrcpad)
*dest_value =
src_value * dvdec->decoder->audio->frequency * scale /
GST_SECOND;
*dest_value = src_value;
break;
default:
res = FALSE;
@ -457,6 +469,9 @@ gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
if (dvdec->length == 0)
return FALSE;
if (*dest_format == GST_FORMAT_DEFAULT)
*dest_format = GST_FORMAT_TIME;
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
@ -470,6 +485,9 @@ gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
*dest_value = (frame * GST_SECOND) / dvdec->framerate;
break;
}
case GST_FORMAT_BYTES:
*dest_value = src_value;
break;
default:
res = FALSE;
}
@ -486,6 +504,9 @@ gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
*dest_value = frame * dvdec->length;
break;
}
case GST_FORMAT_TIME:
*dest_value = src_value;
break;
default:
res = FALSE;
}

View file

@ -172,6 +172,12 @@ gst_progressreport_report (GstProgressReport * progressreport,
GST_QUERY_POSITION, &peer_format, &cur_progress)) {
GstFormat peer_format2 = peer_format;
gchar *format_name = NULL;
gboolean got_total = FALSE;
if ((gst_pad_query (gst_pad_get_peer (progressreport->sinkpad),
GST_QUERY_TOTAL, &peer_format2, &total_progress)) &&
(peer_format == peer_format2))
got_total = TRUE;
switch (peer_format) {
case GST_FORMAT_BYTES:
@ -193,9 +199,7 @@ gst_progressreport_report (GstProgressReport * progressreport,
break;
}
if ((gst_pad_query (gst_pad_get_peer (progressreport->sinkpad),
GST_QUERY_TOTAL, &peer_format2, &total_progress)) &&
(peer_format == peer_format2)) {
if (got_total == TRUE) {
g_print ("%s (%2d:%2d:%2d): %lld / %lld %s (%3.2g %%)\n",
gst_object_get_name (GST_OBJECT (progressreport)), hh, mm, ss,
cur_progress, total_progress, format_name,