ext/mad/: Fix mad and id3tag compilation again.

Original commit message from CVS:
* ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
* ext/mad/gstmad.c: (gst_mad_chain):
Fix mad and id3tag compilation again.
This commit is contained in:
Wim Taymans 2005-05-12 19:48:45 +00:00
parent 8e91c12bb3
commit 075f660a6a
3 changed files with 28 additions and 31 deletions

View file

@ -1,3 +1,9 @@
2005-05-12 Wim Taymans <wim@fluendo.com>
* ext/mad/gstid3tag.c: (gst_id3_tag_src_query):
* ext/mad/gstmad.c: (gst_mad_chain):
Fix mad and id3tag compilation again.
2005-05-12 Wim Taymans <wim@fluendo.com> 2005-05-12 Wim Taymans <wim@fluendo.com>
* gst/udp/.cvsignore: * gst/udp/.cvsignore:

View file

@ -163,8 +163,7 @@ static gboolean gst_id3_tag_src_event (GstPad * pad, GstEvent * event);
static const GstEventMask *gst_id3_tag_get_event_masks (GstPad * pad); static const GstEventMask *gst_id3_tag_get_event_masks (GstPad * pad);
static const GstQueryType *gst_id3_tag_get_query_types (GstPad * pad); static const GstQueryType *gst_id3_tag_get_query_types (GstPad * pad);
static gboolean gst_id3_tag_src_query (GstPad * pad, static gboolean gst_id3_tag_src_query (GstPad * pad, GstQuery * query);
GstQueryType type, GstFormat * format, gint64 * value);
static gboolean gst_id3_tag_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_id3_tag_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer);
@ -429,24 +428,34 @@ gst_id3_tag_get_query_types (GstPad * pad)
} }
static gboolean static gboolean
gst_id3_tag_src_query (GstPad * pad, GstQueryType type, gst_id3_tag_src_query (GstPad * pad, GstQuery * query)
GstFormat * format, gint64 * value)
{ {
gboolean res = FALSE; gboolean res = FALSE;
GstID3Tag *tag; GstID3Tag *tag;
tag = GST_ID3_TAG (gst_pad_get_parent (pad)); tag = GST_ID3_TAG (gst_pad_get_parent (pad));
switch (type) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_TOTAL:{ case GST_QUERY_POSITION:{
switch (*format) { GstFormat format;
gint64 current, total;
gst_query_parse_position (query, &format, NULL, NULL);
switch (format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
if (GST_PAD_PEER (tag->sinkpad) && if (GST_PAD_PEER (tag->sinkpad) &&
tag->state == GST_ID3_TAG_STATE_NORMAL && tag->state == GST_ID3_TAG_STATE_NORMAL &&
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_TOTAL, gst_pad_query_position (GST_PAD_PEER (tag->sinkpad),
format, value)) { &format, &current, &total)) {
*value -= tag->v2tag_size + tag->v1tag_size; total -= tag->v2tag_size + tag->v1tag_size;
*value += tag->v2tag_size_new + tag->v1tag_size_new; total += tag->v2tag_size_new + tag->v1tag_size_new;
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
current -= tag->v2tag_size + tag->v2tag_size_new;
} else {
current = 0;
}
gst_query_set_position (query, format, current, total);
res = TRUE; res = TRUE;
} }
break; break;
@ -455,24 +464,6 @@ gst_id3_tag_src_query (GstPad * pad, GstQueryType type,
} }
break; break;
} }
case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_BYTES:
if (GST_PAD_PEER (tag->sinkpad) &&
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_POSITION,
format, value)) {
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
*value -= tag->v2tag_size + tag->v2tag_size_new;
} else {
*value = 0;
}
res = TRUE;
}
break;
default:
break;
}
break;
default: default:
break; break;
} }

View file

@ -1494,8 +1494,8 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) { if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) {
GstFormat format = GST_FORMAT_DEFAULT; GstFormat format = GST_FORMAT_DEFAULT;
gst_pad_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts, &format, gst_pad_query_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts,
&mad->total_samples); &format, &mad->total_samples);
mad->last_ts = GST_CLOCK_TIME_NONE; mad->last_ts = GST_CLOCK_TIME_NONE;
} }
time_offset = mad->total_samples * GST_SECOND / mad->rate; time_offset = mad->total_samples * GST_SECOND / mad->rate;