summaryrefslogtreecommitdiff
path: root/ext/resindvd
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2012-03-29 17:41:53 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-03-29 17:41:53 +0200
commit860ccd414dbb313fabf065b92838f0f39037584b (patch)
tree0d5c0d3510db3ca3d7e6487420e8d09f74ae1961 /ext/resindvd
parenta9ec4d62a89dd53aa295af02c7d5f57ef936359b (diff)
parentd84d98943af42ce645ee022207bcf04e747d2d4a (diff)
downloadgstreamer-plugins-bad-860ccd414dbb313fabf065b92838f0f39037584b.tar.gz
Merge remote-tracking branch 'origin/0.10'
Conflicts: NEWS RELEASE common configure.ac docs/libs/gst-plugins-bad-libs-sections.txt docs/plugins/gst-plugins-bad-plugins.args docs/plugins/gst-plugins-bad-plugins.hierarchy docs/plugins/gst-plugins-bad-plugins.interfaces docs/plugins/inspect/plugin-adpcmdec.xml docs/plugins/inspect/plugin-adpcmenc.xml docs/plugins/inspect/plugin-assrender.xml docs/plugins/inspect/plugin-audiovisualizers.xml docs/plugins/inspect/plugin-autoconvert.xml docs/plugins/inspect/plugin-bayer.xml docs/plugins/inspect/plugin-bz2.xml docs/plugins/inspect/plugin-camerabin2.xml docs/plugins/inspect/plugin-celt.xml docs/plugins/inspect/plugin-dataurisrc.xml docs/plugins/inspect/plugin-debugutilsbad.xml docs/plugins/inspect/plugin-dtmf.xml docs/plugins/inspect/plugin-dtsdec.xml docs/plugins/inspect/plugin-dvbsuboverlay.xml docs/plugins/inspect/plugin-dvdspu.xml docs/plugins/inspect/plugin-faac.xml docs/plugins/inspect/plugin-faad.xml docs/plugins/inspect/plugin-gsm.xml docs/plugins/inspect/plugin-h264parse.xml docs/plugins/inspect/plugin-mms.xml docs/plugins/inspect/plugin-modplug.xml docs/plugins/inspect/plugin-mpeg2enc.xml docs/plugins/inspect/plugin-mpegdemux2.xml docs/plugins/inspect/plugin-mpegtsdemux.xml docs/plugins/inspect/plugin-mpegvideoparse.xml docs/plugins/inspect/plugin-mplex.xml docs/plugins/inspect/plugin-pcapparse.xml docs/plugins/inspect/plugin-rawparse.xml docs/plugins/inspect/plugin-rtpmux.xml docs/plugins/inspect/plugin-rtpvp8.xml docs/plugins/inspect/plugin-scaletempo.xml docs/plugins/inspect/plugin-schro.xml docs/plugins/inspect/plugin-sdp.xml docs/plugins/inspect/plugin-segmentclip.xml docs/plugins/inspect/plugin-shm.xml docs/plugins/inspect/plugin-videomaxrate.xml docs/plugins/inspect/plugin-videoparsersbad.xml docs/plugins/inspect/plugin-vp8.xml docs/plugins/inspect/plugin-y4mdec.xml ext/celt/gstceltdec.c ext/dts/gstdtsdec.c ext/modplug/gstmodplug.cc ext/opus/gstopusenc.c gst-libs/gst/video/gstbasevideocodec.c gst-libs/gst/video/gstbasevideocodec.h gst-libs/gst/video/gstbasevideodecoder.c gst-libs/gst/video/gstbasevideodecoder.h gst-libs/gst/video/gstbasevideoencoder.c gst-libs/gst/video/gstbasevideoencoder.h gst/adpcmdec/Makefile.am gst/audiovisualizers/gstbaseaudiovisualizer.c gst/h264parse/gsth264parse.c gst/mpegdemux/mpegtsparse.c gst/mpegtsdemux/mpegtsbase.c gst/mpegtsdemux/mpegtspacketizer.c gst/mpegtsdemux/mpegtsparse.c gst/mpegtsdemux/tsdemux.c gst/mpegtsdemux/tsdemux.h gst/mxf/mxfdemux.c gst/rawparse/gstaudioparse.c gst/videoparsers/gsth263parse.c gst/videoparsers/gsth264parse.c sys/d3dvideosink/d3dvideosink.c sys/decklink/gstdecklinksink.cpp sys/dvb/gstdvbsrc.c sys/shm/gstshmsrc.c sys/vdpau/h264/gstvdph264dec.c sys/vdpau/mpeg/gstvdpmpegdec.c tests/examples/opencv/gst_element_print_properties.c win32/common/config.h
Diffstat (limited to 'ext/resindvd')
-rw-r--r--ext/resindvd/resindvdsrc.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index 8ce39a1b2..0b29615bf 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -1037,6 +1037,7 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
break;
case DVDNAV_CELL_CHANGE:{
dvdnav_cell_change_event_t *event = (dvdnav_cell_change_event_t *) data;
+ GstMessage *message;
src->pgc_duration = MPEGTIME_TO_GSTTIME (event->pgc_length);
/* event->cell_start has the wrong time - it doesn't handle
@@ -1050,6 +1051,10 @@ rsn_dvdsrc_step (resinDvdSrc * src, gboolean have_dvd_lock)
GST_TIME_FORMAT, GST_TIME_ARGS (src->pgc_duration),
GST_TIME_ARGS (src->cur_position));
+ message = gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_TIME,
+ src->pgc_duration);
+ gst_element_post_message (GST_ELEMENT (src), message);
+
rsn_dvdsrc_prepare_streamsinfo_event (src);
src->need_tag_update = TRUE;
@@ -2423,6 +2428,53 @@ rsn_dvdsrc_src_event (GstBaseSrc * basesrc, GstEvent * event)
return res;
}
+static void
+rsn_dvdsrc_post_title_info (GstElement * element)
+{
+ resinDvdSrc *src = RESINDVDSRC (element);
+ GstMessage *message;
+ GstStructure *s;
+ int32_t n, ntitles;
+ int res;
+ GValue array = { 0 };
+
+ res = dvdnav_get_number_of_titles (src->dvdnav, &ntitles);
+ if (res != DVDNAV_STATUS_OK) {
+ GST_WARNING_OBJECT (src, "Failed to get number of titles: %d", res);
+ return;
+ }
+
+ g_value_init (&array, GST_TYPE_ARRAY);
+
+ s = gst_structure_new ("application/x-gst-dvd", "event",
+ G_TYPE_STRING, "dvd-title-info", NULL);
+
+ for (n = 0; n < ntitles; ++n) {
+ uint64_t *times, duration;
+ uint32_t nchapters;
+ GValue item = { 0 };
+
+ g_value_init (&item, G_TYPE_UINT64);
+
+ nchapters =
+ dvdnav_describe_title_chapters (src->dvdnav, n, &times, &duration);
+ if (nchapters == 0) {
+ GST_WARNING_OBJECT (src, "Failed to get title %d info", n);
+ g_value_set_uint64 (&item, GST_CLOCK_TIME_NONE);
+ } else {
+ g_value_set_uint64 (&item, gst_util_uint64_scale (duration, GST_SECOND,
+ 90000));
+ }
+ gst_value_array_append_value (&array, &item);
+ g_value_unset (&item);
+ }
+ gst_structure_set_value (s, "title-durations", &array);
+ g_value_unset (&array);
+
+ message = gst_message_new_element (GST_OBJECT (src), s);
+ gst_element_post_message (GST_ELEMENT_CAST (src), message);
+}
+
static GstStateChangeReturn
rsn_dvdsrc_change_state (GstElement * element, GstStateChange transition)
{
@@ -2459,6 +2511,9 @@ rsn_dvdsrc_change_state (GstElement * element, GstStateChange transition)
rsn_dvdsrc_check_nav_blocks (src);
g_mutex_unlock (src->dvd_lock);
break;
+ case GST_STATE_CHANGE_READY_TO_PAUSED:
+ rsn_dvdsrc_post_title_info (element);
+ break;
default:
break;
}
@@ -2486,6 +2541,9 @@ rsn_dvdsrc_src_query (GstBaseSrc * basesrc, GstQuery * query)
if (format == GST_FORMAT_TIME) {
if (src->pgc_duration != GST_CLOCK_TIME_NONE) {
val = src->pgc_duration;
+
+ GST_DEBUG_OBJECT (src, "duration : %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (val));
gst_query_set_duration (query, format, val);
res = TRUE;
}