ext/dvdread/dvdreadsrc.c: Don't implement GstBaseSrc::get_size or GstBaseSrc::is_seekable, otherwise GstBaseSrc will ...
Original commit message from CVS: * ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_class_init), (gst_dvd_read_src_get_size), (gst_dvd_read_src_do_seek), (gst_dvd_read_src_do_duration_query): Don't implement GstBaseSrc::get_size or GstBaseSrc::is_seekable, otherwise GstBaseSrc will think we can operate pull_range based, which we don't really, and typefinding will fail miserably. Also, make seeking work somewhat (only works with flumpegdemux at the moment, mpegstream needs fixing for that first).
This commit is contained in:
parent
0904aa12c9
commit
024b052249
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2006-02-13 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_class_init),
|
||||||
|
(gst_dvd_read_src_get_size), (gst_dvd_read_src_do_seek),
|
||||||
|
(gst_dvd_read_src_do_duration_query):
|
||||||
|
Don't implement GstBaseSrc::get_size or GstBaseSrc::is_seekable,
|
||||||
|
otherwise GstBaseSrc will think we can operate pull_range based,
|
||||||
|
which we don't really, and typefinding will fail miserably.
|
||||||
|
Also, make seeking work somewhat (only works with flumpegdemux
|
||||||
|
at the moment, mpegstream needs fixing for that first).
|
||||||
|
|
||||||
2006-02-13 Tim-Philipp Müller <tim at centricular dot net>
|
2006-02-13 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
|
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_read),
|
||||||
|
@ -86,8 +86,7 @@ static void gst_dvd_read_src_get_property (GObject * object, guint prop_id,
|
|||||||
GValue * value, GParamSpec * pspec);
|
GValue * value, GParamSpec * pspec);
|
||||||
static GstEvent *gst_dvd_read_src_make_clut_change_event (GstDvdReadSrc * src,
|
static GstEvent *gst_dvd_read_src_make_clut_change_event (GstDvdReadSrc * src,
|
||||||
const guint * clut);
|
const guint * clut);
|
||||||
static gboolean gst_dvd_read_src_get_size (GstBaseSrc * bsrc, guint64 * size);
|
static gboolean gst_dvd_read_src_get_size (GstDvdReadSrc * src, gint64 * size);
|
||||||
static gboolean gst_dvd_read_src_seekable (GstBaseSrc * bsrc);
|
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstDvdReadSrc, gst_dvd_read_src, GstPushSrc,
|
GST_BOILERPLATE_FULL (GstDvdReadSrc, gst_dvd_read_src, GstPushSrc,
|
||||||
GST_TYPE_PUSH_SRC, gst_dvd_read_src_do_init)
|
GST_TYPE_PUSH_SRC, gst_dvd_read_src_do_init)
|
||||||
@ -165,8 +164,6 @@ gst_dvd_read_src_class_init (GstDvdReadSrcClass * klass)
|
|||||||
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dvd_read_src_stop);
|
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dvd_read_src_stop);
|
||||||
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_dvd_read_src_src_query);
|
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_dvd_read_src_src_query);
|
||||||
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_dvd_read_src_src_event);
|
gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_dvd_read_src_src_event);
|
||||||
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_dvd_read_src_get_size);
|
|
||||||
gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_dvd_read_src_seekable);
|
|
||||||
|
|
||||||
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_dvd_read_src_create);
|
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_dvd_read_src_create);
|
||||||
}
|
}
|
||||||
@ -766,15 +763,8 @@ gst_dvd_read_src_get_property (GObject * object, guint prop_id, GValue * value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dvd_read_src_seekable (GstBaseSrc * basesrc)
|
gst_dvd_read_src_get_size (GstDvdReadSrc * src, gint64 * size)
|
||||||
{
|
{
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_dvd_read_src_get_size (GstBaseSrc * basesrc, guint64 * size)
|
|
||||||
{
|
|
||||||
GstDvdReadSrc *src = GST_DVD_READ_SRC (basesrc);
|
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (src->dvd_title) {
|
if (src->dvd_title) {
|
||||||
@ -782,7 +772,7 @@ gst_dvd_read_src_get_size (GstBaseSrc * basesrc, guint64 * size)
|
|||||||
|
|
||||||
blocks = DVDFileSize (src->dvd_title);
|
blocks = DVDFileSize (src->dvd_title);
|
||||||
if (blocks >= 0) {
|
if (blocks >= 0) {
|
||||||
*size = (guint64) blocks *DVD_VIDEO_LB_LEN;
|
*size = (gint64) blocks *DVD_VIDEO_LB_LEN;
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -803,6 +793,7 @@ gst_dvd_read_src_do_seek (GstDvdReadSrc * src, GstEvent * event)
|
|||||||
gint64 new_off, total, cur;
|
gint64 new_off, total, cur;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
gboolean query_ok;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
|
|
||||||
srcpad = GST_BASE_SRC (src)->srcpad;
|
srcpad = GST_BASE_SRC (src)->srcpad;
|
||||||
@ -815,11 +806,8 @@ gst_dvd_read_src_do_seek (GstDvdReadSrc * src, GstEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case GST_FORMAT_BYTES:{
|
case GST_FORMAT_BYTES:
|
||||||
new_off /= DVD_VIDEO_LB_LEN;
|
|
||||||
format = sector_format;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:{
|
default:{
|
||||||
if (format != chapter_format &&
|
if (format != chapter_format &&
|
||||||
format != sector_format &&
|
format != sector_format &&
|
||||||
@ -833,19 +821,26 @@ gst_dvd_read_src_do_seek (GstDvdReadSrc * src, GstEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get current offset and length */
|
/* get current offset and length */
|
||||||
gst_pad_query_duration (srcpad, &format, &total);
|
if (format == GST_FORMAT_BYTES) {
|
||||||
gst_pad_query_position (srcpad, &format, &cur);
|
GST_OBJECT_LOCK (src);
|
||||||
|
query_ok = gst_dvd_read_src_get_size (src, &total);
|
||||||
GST_DEBUG_OBJECT (src, "Current %s: %" G_GINT64_FORMAT,
|
cur = (gint64) src->cur_pack * DVD_VIDEO_LB_LEN;
|
||||||
gst_format_get_name (format), cur);
|
GST_OBJECT_UNLOCK (src);
|
||||||
GST_DEBUG_OBJECT (src, "Total %s: %" G_GINT64_FORMAT,
|
} else {
|
||||||
gst_format_get_name (format), total);
|
query_ok = gst_pad_query_duration (srcpad, &format, &total)
|
||||||
|
&& gst_pad_query_position (srcpad, &format, &cur);
|
||||||
if (cur == new_off) {
|
|
||||||
GST_DEBUG_OBJECT (src, "We're already at that position!");
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!query_ok) {
|
||||||
|
GST_DEBUG_OBJECT (src, "Failed to query duration/position");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "Current %s: %12" G_GINT64_FORMAT,
|
||||||
|
gst_format_get_name (format), cur);
|
||||||
|
GST_DEBUG_OBJECT (src, "Total %s: %12" G_GINT64_FORMAT,
|
||||||
|
gst_format_get_name (format), total);
|
||||||
|
|
||||||
/* get absolute */
|
/* get absolute */
|
||||||
switch (cur_type) {
|
switch (cur_type) {
|
||||||
case GST_SEEK_TYPE_SET:
|
case GST_SEEK_TYPE_SET:
|
||||||
@ -867,18 +862,29 @@ gst_dvd_read_src_do_seek (GstDvdReadSrc * src, GstEvent * event)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (src, "Seeking to unit %" G_GINT64_FORMAT, new_off);
|
if (cur == new_off) {
|
||||||
|
GST_DEBUG_OBJECT (src, "We're already at that position!");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (src, "Seeking to %s: %12" G_GINT64_FORMAT,
|
||||||
|
gst_format_get_name (format), new_off);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (src);
|
GST_OBJECT_LOCK (src);
|
||||||
|
|
||||||
if (format == angle_format) {
|
if (format == angle_format) {
|
||||||
src->angle = new_off;
|
src->angle = new_off;
|
||||||
GST_OBJECT_UNLOCK (src);
|
goto done;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format == sector_format) {
|
if (format == sector_format) {
|
||||||
src->cur_pack = new_off;
|
src->cur_pack = new_off;
|
||||||
|
} else if (format == GST_FORMAT_BYTES) {
|
||||||
|
src->cur_pack = new_off / DVD_VIDEO_LB_LEN;
|
||||||
|
if ((src->cur_pack * DVD_VIDEO_LB_LEN) != new_off) {
|
||||||
|
GST_LOG_OBJECT (src, "rounded down offset %" G_GINT64_FORMAT " => %"
|
||||||
|
G_GINT64_FORMAT, new_off, (gint64) src->cur_pack * DVD_VIDEO_LB_LEN);
|
||||||
|
}
|
||||||
} else if (format == chapter_format) {
|
} else if (format == chapter_format) {
|
||||||
src->cur_pack = 0;
|
src->cur_pack = 0;
|
||||||
src->chapter = new_off;
|
src->chapter = new_off;
|
||||||
@ -898,6 +904,8 @@ gst_dvd_read_src_do_seek (GstDvdReadSrc * src, GstEvent * event)
|
|||||||
if ((flags & GST_SEEK_FLAG_FLUSH) != 0)
|
if ((flags & GST_SEEK_FLAG_FLUSH) != 0)
|
||||||
src->flush_pend = TRUE;
|
src->flush_pend = TRUE;
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -983,12 +991,8 @@ gst_dvd_read_src_do_duration_query (GstDvdReadSrc * src, GstQuery * query)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_FORMAT_BYTES:{
|
case GST_FORMAT_BYTES:{
|
||||||
guint64 size;
|
if (!gst_dvd_read_src_get_size (src, &val))
|
||||||
|
|
||||||
if (!gst_dvd_read_src_get_size (GST_BASE_SRC (src), &size))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
val = (gint64) size;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:{
|
default:{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user