index 79eb9801a9b75f1853876212579c3b3200820a39..a53019f9fd41dcdede6b7e670281c04c88423d94 100644 (file)
--- a/ext/dvdread/dvdreadsrc.c
+++ b/ext/dvdread/dvdreadsrc.c
ARG_ANGLE
};
-static GstElementDetails gst_dvd_read_src_details = {
- "DVD Source",
- "Source/File/DVD",
- "Access a DVD title/chapter/angle using libdvdread",
- "Erik Walthinsen <omega@cse.ogi.edu>",
-};
-
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
- gst_element_class_set_details (element_class, &gst_dvd_read_src_details);
+ gst_element_class_set_details_simple (element_class, "DVD Source",
+ "Source/File/DVD",
+ "Access a DVD title/chapter/angle using libdvdread",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
}
static void
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE,
g_param_spec_string ("device", "Device",
- "DVD device location", NULL, G_PARAM_READWRITE));
+ "DVD device location", NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TITLE,
g_param_spec_int ("title", "title", "title",
- 1, 999, 1, G_PARAM_READWRITE));
+ 1, 999, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CHAPTER,
g_param_spec_int ("chapter", "chapter", "chapter",
- 1, 999, 1, G_PARAM_READWRITE));
+ 1, 999, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ANGLE,
g_param_spec_int ("angle", "angle", "angle",
- 1, 999, 1, G_PARAM_READWRITE));
+ 1, 999, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_dvd_read_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dvd_read_src_stop);
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(_("Could not open DVD title %d. Interactive titles are not supported "
"by this element"), title_set_nr),
- ("Commands-only PGC, not supported, use dvdnavsrc"));
+ ("Commands-only PGC, not supported, use rsndvdbin"));
return FALSE;
}
}
if (pgc->cell_playback[cell].block_type != BLOCK_TYPE_ANGLE_BLOCK)
return (cell + 1);
- while (pgc->cell_playback[cell].block_mode == BLOCK_MODE_LAST_CELL)
+ while (pgc->cell_playback[cell].block_mode != BLOCK_MODE_LAST_CELL)
++cell;
- return cell + 1; /* really +1? (tpm) */
+ return cell + 1;
}
/* Returns true if the pack is a NAV pack */
static gint
gst_dvd_read_src_get_sector_from_time (GstDvdReadSrc * src, GstClockTime ts)
{
- gint sector, i, j;
+ gint sector, j;
- if (src->vts_tmapt == NULL || src->vts_tmapt->nr_of_tmaps == 0)
+ if (src->vts_tmapt == NULL || src->vts_tmapt->nr_of_tmaps < src->ttn)
return -1;
sector = 0;
- for (i = 0; i < src->vts_tmapt->nr_of_tmaps; ++i) {
- for (j = 0; j < src->vts_tmapt->tmap[i].nr_of_entries; ++j) {
- GstClockTime entry_time;
+ for (j = 0; j < src->vts_tmapt->tmap[src->ttn - 1].nr_of_entries; ++j) {
+ GstClockTime entry_time;
- entry_time = src->vts_tmapt->tmap[i].tmu * (j + 1) * GST_SECOND;
- if (entry_time <= ts) {
- sector = src->vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff;
- }
- if (entry_time >= ts) {
- return sector;
- }
+ entry_time = src->vts_tmapt->tmap[src->ttn - 1].tmu * (j + 1) * GST_SECOND;
+ if (entry_time <= ts) {
+ sector = src->vts_tmapt->tmap[src->ttn - 1].map_ent[j] & 0x7fffffff;
+ }
+ if (entry_time >= ts) {
+ return sector;
}
}
GstSegment *seg;
guint8 oneblock[DVD_VIDEO_LB_LEN];
dsi_t dsi_pack;
- guint next_vobu, next_ilvu_start, cur_output_size;
+ guint next_vobu, cur_output_size;
gint len;
gint retries;
gint64 next_time;
/* determine where we go next. These values are the ones we
* mostly care about */
- next_ilvu_start = src->cur_pack + dsi_pack.sml_agli.data[angle].address;
cur_output_size = dsi_pack.dsi_gi.vobu_ea + 1;
/* If we're not at the end of this cell, we can determine the next
}
}
+/* we don't cache the result on purpose */
+static gboolean
+gst_dvd_read_descrambler_available (void)
+{
+ GModule *module;
+ gpointer sym;
+ gsize res;
+
+ module = g_module_open ("libdvdcss", 0);
+ if (module != NULL) {
+ res = g_module_symbol (module, "dvdcss_open", &sym);
+ g_module_close (module);
+ } else {
+ res = FALSE;
+ }
+
+ return res;
+}
+
static GstFlowReturn
gst_dvd_read_src_create (GstPushSrc * pushsrc, GstBuffer ** p_buf)
{
switch (res) {
case GST_DVD_READ_ERROR:{
- GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), (NULL));
+ /* FIXME: figure out a way to detect if scrambling is the problem */
+ if (!gst_dvd_read_descrambler_available ()) {
+ GST_ELEMENT_ERROR (src, RESOURCE, READ,
+ (_("Could not read DVD. This may be because the DVD is encrypted "
+ "and a DVD decryption library is not installed.")), (NULL));
+ } else {
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (_("Could not read DVD.")),
+ (NULL));
+ }
return GST_FLOW_ERROR;
}
case GST_DVD_READ_EOS:{
static gchar **
gst_dvd_read_src_uri_get_protocols (void)
{
- static gchar *protocols[] = { "dvd", NULL };
+ static gchar *protocols[] = { (gchar *) "dvd", NULL };
return protocols;
}
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif /* ENABLE_NLS */
if (!gst_element_register (plugin, "dvdreadsrc", GST_RANK_SECONDARY,