fix for basesrc changes

This commit is contained in:
Wim Taymans 2011-12-06 13:59:11 +01:00
parent 43aa0a8aca
commit 9e97260c9f

View file

@ -443,7 +443,8 @@ gst_audio_cd_src_convert (GstAudioCdSrc * src, GstFormat src_format,
return TRUE; return TRUE;
} }
started = GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_STARTED); started =
GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_FLAG_STARTED);
if (src_format == track_format) { if (src_format == track_format) {
if (!started) if (!started)
@ -573,7 +574,7 @@ gst_audio_cd_src_query (GstBaseSrc * basesrc, GstQuery * query)
GstAudioCdSrc *src = GST_AUDIO_CD_SRC (basesrc); GstAudioCdSrc *src = GST_AUDIO_CD_SRC (basesrc);
gboolean started; gboolean started;
started = GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED); started = GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_FLAG_STARTED);
GST_LOG_OBJECT (src, "handling %s query", GST_LOG_OBJECT (src, "handling %s query",
gst_query_type_get_name (GST_QUERY_TYPE (query))); gst_query_type_get_name (GST_QUERY_TYPE (query)));
@ -859,7 +860,7 @@ gst_audio_cd_src_handle_event (GstBaseSrc * basesrc, GstEvent * event)
gdouble rate; gdouble rate;
gint64 start, stop; gint64 start, stop;
if (!GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_STARTED)) { if (!GST_OBJECT_FLAG_IS_SET (basesrc, GST_BASE_SRC_FLAG_STARTED)) {
GST_DEBUG_OBJECT (src, "seek failed: device not open"); GST_DEBUG_OBJECT (src, "seek failed: device not open");
break; break;
} }
@ -918,7 +919,7 @@ gst_audio_cd_src_uri_get_uri (GstURIHandler * handler)
* existing URI perhaps? */ * existing URI perhaps? */
g_free (src->uri); g_free (src->uri);
if (GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_STARTED)) { if (GST_OBJECT_FLAG_IS_SET (GST_BASE_SRC (src), GST_BASE_SRC_FLAG_STARTED)) {
src->uri = src->uri =
g_strdup_printf ("cdda://%s#%d", src->device, g_strdup_printf ("cdda://%s#%d", src->device,
(src->uri_track > 0) ? src->uri_track : 1); (src->uri_track > 0) ? src->uri_track : 1);
@ -1416,20 +1417,11 @@ gst_audio_cd_src_start (GstBaseSrc * basesrc)
g_free (device); g_free (device);
device = NULL; device = NULL;
if (!ret) { if (!ret)
GST_DEBUG_OBJECT (basesrc, "failed to open device"); goto open_failed;
/* subclass (should have) posted an error message with the details */
gst_audio_cd_src_stop (basesrc);
return FALSE;
}
if (src->num_tracks == 0 || src->tracks == NULL) { if (src->num_tracks == 0 || src->tracks == NULL)
GST_DEBUG_OBJECT (src, "no tracks"); goto no_tracks;
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(_("This CD has no audio tracks")), (NULL));
gst_audio_cd_src_stop (basesrc);
return FALSE;
}
/* need to calculate disc IDs before we ditch the data tracks */ /* need to calculate disc IDs before we ditch the data tracks */
gst_audio_cd_src_calculate_cddb_id (src); gst_audio_cd_src_calculate_cddb_id (src);
@ -1456,13 +1448,8 @@ gst_audio_cd_src_start (GstBaseSrc * basesrc)
while (src->num_tracks > 0 && !src->tracks[src->num_tracks - 1].is_audio) while (src->num_tracks > 0 && !src->tracks[src->num_tracks - 1].is_audio)
--src->num_tracks; --src->num_tracks;
if (src->num_tracks == 0) { if (src->num_tracks == 0)
GST_DEBUG_OBJECT (src, "no audio tracks"); goto no_tracks;
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(_("This CD has no audio tracks")), (NULL));
gst_audio_cd_src_stop (basesrc);
return FALSE;
}
gst_audio_cd_src_add_tags (src); gst_audio_cd_src_add_tags (src);
@ -1485,6 +1472,23 @@ gst_audio_cd_src_start (GstBaseSrc * basesrc)
gst_audio_cd_src_update_duration (src); gst_audio_cd_src_update_duration (src);
return TRUE; return TRUE;
/* ERRORS */
open_failed:
{
GST_DEBUG_OBJECT (basesrc, "failed to open device");
/* subclass (should have) posted an error message with the details */
gst_audio_cd_src_stop (basesrc);
return FALSE;
}
no_tracks:
{
GST_DEBUG_OBJECT (src, "no audio tracks");
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(_("This CD has no audio tracks")), (NULL));
gst_audio_cd_src_stop (basesrc);
return FALSE;
}
} }
static void static void