{
gint64 duration;
- GstFormat fmt = GST_FORMAT_TIME;
- if (gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE
- (flacparse)), &fmt, &duration) && fmt == GST_FORMAT_TIME) {
+ if (gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (flacparse),
+ GST_FORMAT_TIME, &duration)) {
duration = GST_CLOCK_TIME_TO_FRAMES (duration, flacparse->samplerate);
data[17] |= (duration >> 32) & 0xff;
gint offset_xing, offset_vbri;
guint64 avail;
gint64 upstream_total_bytes = 0;
- GstFormat fmt = GST_FORMAT_BYTES;
guint32 read_id_xing = 0, read_id_vbri = 0;
guint8 *data, *origdata;
gsize bufsize;
}
/* obtain real upstream total bytes */
- fmt = GST_FORMAT_BYTES;
- if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE
- (mp3parse)), &fmt, &upstream_total_bytes))
+ if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (mp3parse),
+ GST_FORMAT_BYTES, &upstream_total_bytes))
upstream_total_bytes = 0;
if (read_id_xing == xing_id || read_id_xing == info_id) {
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION:{
- GstFormat bformat = GST_FORMAT_BYTES;
GstFormat format;
gint64 len, val;
gst_query_parse_duration (query, &format, NULL);
- if (!gst_pad_query_peer_duration (auparse->sinkpad, &bformat, &len)) {
+ if (!gst_pad_query_peer_duration (auparse->sinkpad, GST_FORMAT_BYTES,
+ &len)) {
GST_DEBUG_OBJECT (auparse, "failed to query upstream length");
break;
}
len -= auparse->offset;
GST_OBJECT_UNLOCK (auparse);
- ret = gst_au_parse_src_convert (auparse, bformat, len, format, &val);
+ ret =
+ gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, len, format,
+ &val);
if (ret) {
gst_query_set_duration (query, format, val);
break;
}
case GST_QUERY_POSITION:{
- GstFormat bformat = GST_FORMAT_BYTES;
GstFormat format;
gint64 pos, val;
gst_query_parse_position (query, &format, NULL);
- if (!gst_pad_query_peer_position (auparse->sinkpad, &bformat, &pos)) {
+ if (!gst_pad_query_peer_position (auparse->sinkpad, GST_FORMAT_BYTES,
+ &pos)) {
GST_DEBUG_OBJECT (auparse, "failed to query upstream position");
break;
}
if (stream->idx_n >= 0)
gst_query_set_duration (query, fmt, stream->idx_n);
else if (gst_pad_query_convert (pad, GST_FORMAT_TIME,
- duration, &fmt, &dur))
+ duration, fmt, &dur))
gst_query_set_duration (query, fmt, dur);
break;
}
{
GstFlowReturn res;
GstAviStream *stream;
- GstFormat format;
guint64 pos = 0;
guint64 length;
gint64 tmplength;
GST_DEBUG_OBJECT (avi, "Creating index");
/* get the size of the file */
- format = GST_FORMAT_BYTES;
- if (!gst_pad_query_peer_duration (avi->sinkpad, &format, &tmplength))
+ if (!gst_pad_query_peer_duration (avi->sinkpad, GST_FORMAT_BYTES, &tmplength))
return FALSE;
length = tmplength;
/* try harder to query upstream size if we didn't get it the first time */
if (seekable && stop == -1) {
- GstFormat fmt = GST_FORMAT_BYTES;
-
GST_DEBUG_OBJECT (avi, "doing duration query to fix up unset stop");
- gst_pad_query_peer_duration (avi->sinkpad, &fmt, &stop);
+ gst_pad_query_peer_duration (avi->sinkpad, GST_FORMAT_BYTES, &stop);
}
/* if upstream doesn't know the size, it's likely that it's not seekable in
GstAviStream *stream;
seek_time = segment->position;
- keyframe = !!(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
+ keyframe = ! !(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
GST_DEBUG_OBJECT (avi, "seek to: %" GST_TIME_FORMAT
" keyframe seeking:%d", GST_TIME_ARGS (seek_time), keyframe);
/* we have to have a format as the segment format. Try to convert
* if not. */
if (format != GST_FORMAT_TIME) {
- GstFormat fmt = GST_FORMAT_TIME;
gboolean res = TRUE;
if (cur_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, format, cur, &fmt, &cur);
+ res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, format, stop, &fmt, &stop);
+ res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
if (!res)
goto no_format;
- format = fmt;
+ format = GST_FORMAT_TIME;
}
GST_DEBUG_OBJECT (avi,
"seek requested: rate %g cur %" GST_TIME_FORMAT " stop %"
&cur_type, &cur, &stop_type, &stop);
if (format != GST_FORMAT_TIME) {
- GstFormat fmt = GST_FORMAT_TIME;
gboolean res = TRUE;
if (cur_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, format, cur, &fmt, &cur);
+ res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, format, stop, &fmt, &stop);
+ res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
if (!res) {
GST_DEBUG_OBJECT (avi, "unsupported format given, seek aborted.");
return FALSE;
}
- format = fmt;
+ format = GST_FORMAT_TIME;
}
/* let gst_segment handle any tricky stuff */
gst_segment_do_seek (&seeksegment, rate, format, flags,
cur_type, cur, stop_type, stop, &update);
- keyframe = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
+ keyframe = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
cur = seeksegment.position;
GST_DEBUG_OBJECT (avi,
guint32 size = 0;
gint stream_nr = 0;
GstFlowReturn res = GST_FLOW_OK;
- GstFormat format = GST_FORMAT_TIME;
if (G_UNLIKELY (avi->have_eos)) {
/* Clean adapter, we're done */
gst_buffer_unref (buf);
} else {
/* get time of this buffer */
- gst_pad_query_position (stream->pad, &format, (gint64 *) & next_ts);
- if (G_UNLIKELY (format != GST_FORMAT_TIME))
- goto wrong_format;
+ gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
+ (gint64 *) & next_ts);
gst_avi_demux_add_assoc (avi, stream, next_ts, offset, FALSE);
/* invert the picture if needed */
buf = gst_avi_demux_invert (stream, buf);
- gst_pad_query_position (stream->pad, &format, (gint64 *) & dur_ts);
- if (G_UNLIKELY (format != GST_FORMAT_TIME))
- goto wrong_format;
+ gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
+ (gint64 *) & dur_ts);
GST_BUFFER_TIMESTAMP (buf) = next_ts;
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
}
}
-done:
return res;
-
- /* ERRORS */
-wrong_format:
- {
- GST_DEBUG_OBJECT (avi, "format %s != GST_FORMAT_TIME",
- gst_format_get_name (format));
- res = GST_FLOW_ERROR;
- goto done;
- }
}
/*
static void
gst_navseek_seek (GstNavSeek * navseek, gint64 offset)
{
- GstFormat peer_format = GST_FORMAT_TIME;
gboolean ret;
GstPad *peer_pad;
gint64 peer_value;
/* Query for the current time then attempt to set to time + offset */
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
- ret = gst_pad_query_position (peer_pad, &peer_format, &peer_value);
+ ret = gst_pad_query_position (peer_pad, GST_FORMAT_TIME, &peer_value);
- if (ret && peer_format == GST_FORMAT_TIME) {
+ if (ret) {
GstEvent *event;
peer_value += offset;
static void
gst_navseek_change_playback_rate (GstNavSeek * navseek, gdouble rate)
{
- GstFormat peer_format = GST_FORMAT_TIME;
gboolean ret;
GstPad *peer_pad;
gint64 current_position;
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
- ret = gst_pad_query_position (peer_pad, &peer_format, ¤t_position);
+ ret = gst_pad_query_position (peer_pad, GST_FORMAT_TIME, ¤t_position);
- if (ret && peer_format == GST_FORMAT_TIME) {
+ if (ret) {
GstEvent *event;
gint64 start;
gint64 stop;
if (filter->do_query || !buf) {
GST_LOG_OBJECT (filter, "using upstream query");
- if (!gst_pad_query_peer_position (sink_pad, &format, &cur) ||
- !gst_pad_query_peer_duration (sink_pad, &format, &total)) {
+ if (!gst_pad_query_peer_position (sink_pad, format, &cur) ||
+ !gst_pad_query_peer_duration (sink_pad, format, &total)) {
return FALSE;
}
} else {
gboolean key;
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
- key = !!(GST_INDEX_ASSOC_FLAGS (entry) & GST_ASSOCIATION_FLAG_KEY_UNIT);
+ key = ! !(GST_INDEX_ASSOC_FLAGS (entry) & GST_ASSOCIATION_FLAG_KEY_UNIT);
GST_LOG_OBJECT (demux, "position already mapped to time %" GST_TIME_FORMAT
", keyframe %d", GST_TIME_ARGS (time), key);
/* there is not really a way to delete the existing one */
- if (time != ts || key != !!keyframe)
+ if (time != ts || key != ! !keyframe)
GST_DEBUG_OBJECT (demux, "metadata mismatch");
#endif
return;
/* try harder to query upstream size if we didn't get it the first time */
if (demux->upstream_seekable && stop == -1) {
- GstFormat fmt = GST_FORMAT_BYTES;
-
GST_DEBUG_OBJECT (demux, "doing duration query to fix up unset stop");
- gst_pad_query_peer_duration (demux->sinkpad, &fmt, &stop);
+ gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &stop);
}
/* if upstream doesn't know the size, it's likely that it's not seekable in
gst_flv_demux_create_index (GstFlvDemux * demux, gint64 pos, GstClockTime ts)
{
gint64 size;
- GstFormat fmt = GST_FORMAT_BYTES;
size_t tag_size;
guint64 old_offset;
GstBuffer *buffer;
GstClockTime tag_time;
GstFlowReturn ret = GST_FLOW_OK;
- if (G_UNLIKELY (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &size) ||
- fmt != GST_FORMAT_BYTES))
+ if (!gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &size))
return GST_FLOW_OK;
GST_DEBUG_OBJECT (demux, "building index at %" G_GINT64_FORMAT
gst_flv_demux_get_metadata (GstFlvDemux * demux)
{
gint64 ret = 0, offset;
- GstFormat fmt = GST_FORMAT_BYTES;
size_t tag_size, size;
GstBuffer *buffer = NULL;
guint8 *data;
- if (G_UNLIKELY (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &offset)
- || fmt != GST_FORMAT_BYTES))
+ if (!gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &offset))
goto exit;
ret = offset;
if (format != GST_FORMAT_TIME)
goto wrong_format;
- flush = !!(flags & GST_SEEK_FLAG_FLUSH);
+ flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
/* FIXME : the keyframe flag is never used ! */
/* Work on a copy until we are sure the seek succeeded. */
if (!demux->indexed) {
guint64 seek_offset = 0;
gboolean building_index;
- GstFormat fmt;
GST_OBJECT_LOCK (demux);
/* handle the seek in the chain function */
building_index = demux->building_index;
if (!building_index) {
demux->building_index = TRUE;
- fmt = GST_FORMAT_BYTES;
if (!demux->file_size
- && !gst_pad_query_peer_duration (demux->sinkpad, &fmt,
+ && !gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES,
&demux->file_size)) {
- GST_WARNING_OBJECT (demux,
- "Cannot obtain file size - %" G_GINT64_FORMAT ", format %u",
- demux->file_size, fmt);
+ GST_WARNING_OBJECT (demux, "Failed to query upstream file size");
GST_OBJECT_UNLOCK (demux);
return FALSE;
}
demux->seeking = seeking;
GST_OBJECT_UNLOCK (demux);
- flush = !!(flags & GST_SEEK_FLAG_FLUSH);
+ flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
/* FIXME : the keyframe flag is never used */
if (flush) {
if (mux->duration == GST_CLOCK_TIME_NONE) {
GSList *l;
-
- GstFormat fmt = GST_FORMAT_TIME;
guint64 dur;
for (l = mux->collect->data; l; l = l->next) {
GstCollectData *cdata = l->data;
- fmt = GST_FORMAT_TIME;
-
- if (gst_pad_query_peer_duration (cdata->pad, &fmt, (gint64 *) & dur) &&
- fmt == GST_FORMAT_TIME && dur != GST_CLOCK_TIME_NONE) {
+ if (gst_pad_query_peer_duration (cdata->pad, GST_FORMAT_TIME,
+ (gint64 *) & dur) && dur != GST_CLOCK_TIME_NONE) {
if (mux->duration == GST_CLOCK_TIME_NONE)
mux->duration = dur;
else
GstSeekType cur_type, gint64 * cur, GstSeekType stop_type, gint64 * stop)
{
gboolean res;
- GstFormat fmt;
g_return_val_if_fail (format != NULL, FALSE);
g_return_val_if_fail (cur != NULL, FALSE);
if (*format == GST_FORMAT_TIME)
return TRUE;
- fmt = GST_FORMAT_TIME;
res = TRUE;
if (cur_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, *format, *cur, &fmt, cur);
+ res = gst_pad_query_convert (pad, *format, *cur, GST_FORMAT_TIME, cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (pad, *format, *stop, &fmt, stop);
+ res = gst_pad_query_convert (pad, *format, *stop, GST_FORMAT_TIME, stop);
if (res)
*format = GST_FORMAT_TIME;
static void
gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
{
- GstFormat format = GST_FORMAT_BYTES;
QtDemuxStream *stream = NULL;
gint64 size, duration, sys_bitrate, sum_bitrate = 0;
gint i;
GST_DEBUG_OBJECT (qtdemux, "Looking for streams with unknown bitrate");
- if (!gst_pad_query_peer_duration (qtdemux->sinkpad, &format, &size) ||
- format != GST_FORMAT_BYTES) {
+ if (!gst_pad_query_peer_duration (qtdemux->sinkpad, GST_FORMAT_BYTES, &size)) {
GST_DEBUG_OBJECT (qtdemux,
"Size in bytes of the stream not known - bailing");
return;
if (cur_type != GST_SEEK_TYPE_NONE)
res =
gst_pad_query_convert (wav->srcpad, format, cur,
- &wav->segment.format, &cur);
+ wav->segment.format, &cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
res =
gst_pad_query_convert (wav->srcpad, format, stop,
- &wav->segment.format, &stop);
+ wav->segment.format, &stop);
if (!res)
goto no_format;
/* make sure filesize is not exceeded due to rounding errors or so,
* same precaution as in _stream_headers */
bformat = GST_FORMAT_BYTES;
- if (gst_pad_query_peer_duration (wav->sinkpad, &bformat, &upstream_size))
+ if (gst_pad_query_peer_duration (wav->sinkpad, bformat, &upstream_size))
wav->end_offset = MIN (wav->end_offset, upstream_size);
/* this is the range of bytes we will use for playback */
GstCaps *caps = NULL;
gchar *codec_name = NULL;
GstEvent **event_p;
- GstFormat bformat;
gint64 upstream_size = 0;
/* search for "_fmt" chunk, which should be first */
}
- bformat = GST_FORMAT_BYTES;
- gst_pad_query_peer_duration (wav->sinkpad, &bformat, &upstream_size);
+ gst_pad_query_peer_duration (wav->sinkpad, GST_FORMAT_BYTES, &upstream_size);
GST_DEBUG_OBJECT (wav, "upstream size %" G_GUINT64_FORMAT, upstream_size);
/* loop headers until we get data */