mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
ext/dvdread/dvdreadsrc.c: Add convert query (needed for later when we just operate in time format and let the base so...
Original commit message from CVS: * ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read): Add convert query (needed for later when we just operate in time format and let the base source class handle all the seeking stuff).
This commit is contained in:
parent
f960e4ca4d
commit
a61b2c99ab
2 changed files with 111 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,9 @@
|
|||
2006-09-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read):
|
||||
Add convert query (needed for later when we just operate in time
|
||||
format and let the base source class handle all the seeking stuff).
|
||||
|
||||
2006-09-07 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* gst/asfdemux/gstasfdemux.c:
|
||||
|
@ -17,13 +23,13 @@
|
|||
|
||||
2006-09-01 Michael Smith <msmith@fluendo.com>
|
||||
|
||||
Patch by: Michal Benes <michal.benes@itonis.tv>:
|
||||
|
||||
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
|
||||
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
|
||||
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
|
||||
(gst_a52dec_set_property), (gst_a52dec_get_property):
|
||||
* ext/a52dec/gsta52dec.h:
|
||||
Patch from from Michal Benes <michal.benes@itonis.tv>:
|
||||
|
||||
Add two things to a52dec: configure the exact output format for ac3
|
||||
decoding through properties, if desired.
|
||||
By default, configure an output format preferred by downstream. Now
|
||||
|
@ -48,7 +54,7 @@
|
|||
2006-08-27 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* gst/mpegstream/gstmpegpacketize.c: (gst_mpeg_packetize_new):
|
||||
fix build for debug disabled
|
||||
Fix build for debug disabled
|
||||
|
||||
2006-08-22 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
|
|
|
@ -1339,6 +1339,103 @@ gst_dvd_read_src_do_position_query (GstDvdReadSrc * src, GstQuery * query)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvd_read_src_do_convert_query (GstBaseSrc * basesrc, GstQuery * query)
|
||||
{
|
||||
GstDvdReadSrc *src = GST_DVD_READ_SRC (basesrc);
|
||||
GstFormat src_format, dest_format;
|
||||
gboolean ret = FALSE;
|
||||
gint64 src_val, dest_val;
|
||||
|
||||
gst_query_parse_convert (query, &src_format, &src_val, &dest_format, NULL);
|
||||
|
||||
if (src_format == dest_format) {
|
||||
dest_val = src_val;
|
||||
ret = TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Formats to consider: TIME, DEFAULT, BYTES, title, chapter, sector.
|
||||
* Note: title and chapter are counted as starting from 0 here, just like
|
||||
* in the context of seek events. Another note: DEFAULT format is undefined */
|
||||
|
||||
if (src_format == GST_FORMAT_BYTES) {
|
||||
src_format = sector_format;
|
||||
src_val /= DVD_VIDEO_LB_LEN;
|
||||
}
|
||||
|
||||
if (src_format == sector_format) {
|
||||
/* SECTOR => xyz */
|
||||
if (dest_format == GST_FORMAT_TIME && src_val < G_MAXUINT) {
|
||||
dest_val = gst_dvd_read_src_get_time_for_sector (src, (guint) src_val);
|
||||
ret = (dest_val >= 0);
|
||||
} else if (dest_format == GST_FORMAT_BYTES) {
|
||||
dest_val = src_val * DVD_VIDEO_LB_LEN;
|
||||
ret = TRUE;
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else if (src_format == title_format) {
|
||||
/* TITLE => xyz */
|
||||
if (dest_format == GST_FORMAT_TIME) {
|
||||
/* not really true, but we use this to trick the base source into
|
||||
* handling seeks in title-format for us (the source won't know that
|
||||
* we changed the title in this case) (changing titles should really
|
||||
* be done with an interface rather than a seek, but for now we're
|
||||
* stuck with this mechanism. Fix in 0.11) */
|
||||
dest_val = (GstClockTime) 0;
|
||||
ret = TRUE;
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else if (src_format == chapter_format) {
|
||||
/* CHAPTER => xyz */
|
||||
if (dest_format == GST_FORMAT_TIME) {
|
||||
if (src->num_chapters >= 0 && src_val < src->num_chapters) {
|
||||
dest_val = src->chapter_starts[src_val];
|
||||
ret = TRUE;
|
||||
}
|
||||
} else if (dest_format == sector_format) {
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else if (src_format == GST_FORMAT_TIME) {
|
||||
/* TIME => xyz */
|
||||
if (dest_format == sector_format || dest_format == GST_FORMAT_BYTES) {
|
||||
dest_val = gst_dvd_read_src_get_sector_from_time (src, src_val);
|
||||
ret = (dest_val >= 0);
|
||||
if (dest_format == GST_FORMAT_BYTES)
|
||||
dest_val *= DVD_VIDEO_LB_LEN;
|
||||
} else if (dest_format == chapter_format) {
|
||||
if (src->chapter_starts != NULL) {
|
||||
gint i;
|
||||
|
||||
for (i = src->num_chapters - 1; i >= 0; --i) {
|
||||
if (src->chapter_starts && src->chapter_starts[i] >= src_val) {
|
||||
dest_val = i;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
} else {
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
if (ret) {
|
||||
gst_query_set_convert (query, src_format, src_val, dest_format, dest_val);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvd_read_src_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
||||
{
|
||||
|
@ -1369,6 +1466,11 @@ gst_dvd_read_src_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
|||
res = gst_dvd_read_src_do_position_query (src, query);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
break;
|
||||
case GST_QUERY_CONVERT:
|
||||
GST_OBJECT_LOCK (src);
|
||||
res = gst_dvd_read_src_do_convert_query (src, query);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
break;
|
||||
default:
|
||||
res = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue