Merge remote-tracking branch 'origin/0.10'
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Tue, 10 Apr 2012 09:57:53 +0000 (11:57 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Tue, 10 Apr 2012 09:57:53 +0000 (11:57 +0200)
Conflicts:
gst/flv/gstflvdemux.c
gst/matroska/matroska-demux.c

1  2 
gst/flv/gstflvdemux.c
gst/matroska/matroska-demux.c

@@@ -100,11 -96,10 +100,12 @@@ static gboolean flv_demux_handle_seek_p
  static gboolean gst_flv_demux_handle_seek_pull (GstFlvDemux * demux,
      GstEvent * event, gboolean seeking);
  
 -static gboolean gst_flv_demux_query (GstPad * pad, GstQuery * query);
 -static gboolean gst_flv_demux_src_event (GstPad * pad, GstEvent * event);
 +static gboolean gst_flv_demux_query (GstPad * pad, GstObject * parent,
 +    GstQuery * query);
 +static gboolean gst_flv_demux_src_event (GstPad * pad, GstObject * parent,
 +    GstEvent * event);
  
+ static GstIndex *gst_flv_demux_get_index (GstElement * element);
  
  static void
  gst_flv_demux_parse_and_add_index_entry (GstFlvDemux * demux, GstClockTime ts,
@@@ -2178,7 -2148,8 +2188,8 @@@ gst_flv_demux_move_to_offset (GstFlvDem
  static GstFlowReturn
  gst_flv_demux_seek_to_prev_keyframe (GstFlvDemux * demux)
  {
 -  GstFlowReturn ret = GST_FLOW_UNEXPECTED;
 +  GstFlowReturn ret = GST_FLOW_EOS;
+   GstIndex *index;
    GstIndexEntry *entry = NULL;
  
    GST_DEBUG_OBJECT (demux,
          GST_INDEX_LOOKUP_BEFORE, GST_ASSOCIATION_FLAG_KEY_UNIT,
          GST_FORMAT_BYTES, demux->from_offset - 1);
  
-   if (entry) {
-     gint64 bytes = 0, time = 0;
+     if (entry) {
 -      gint64 bytes, time;
++      gint64 bytes = 0, time = 0;
  
-     gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &bytes);
-     gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
+       gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &bytes);
+       gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
  
-     GST_DEBUG_OBJECT (demux, "found index entry for %" G_GINT64_FORMAT
-         " at %" GST_TIME_FORMAT ", seeking to %" G_GINT64_FORMAT,
-         demux->offset - 1, GST_TIME_ARGS (time), bytes);
+       GST_DEBUG_OBJECT (demux, "found index entry for %" G_GINT64_FORMAT
+           " at %" GST_TIME_FORMAT ", seeking to %" G_GINT64_FORMAT,
+           demux->offset - 1, GST_TIME_ARGS (time), bytes);
  
-     /* setup for next section */
-     demux->to_offset = demux->from_offset;
-     gst_flv_demux_move_to_offset (demux, bytes, FALSE);
-     ret = GST_FLOW_OK;
+       /* setup for next section */
+       demux->to_offset = demux->from_offset;
+       gst_flv_demux_move_to_offset (demux, bytes, FALSE);
+       ret = GST_FLOW_OK;
+     }
+     gst_object_unref (index);
    }
  
  done:
    return ret;
  }
@@@ -2478,11 -2457,13 +2496,13 @@@ gst_flv_demux_find_offset (GstFlvDemux 
  
    g_return_val_if_fail (segment != NULL, 0);
  
 -  time = segment->last_stop;
 +  time = segment->position;
  
-   if (demux->index) {
+   index = gst_flv_demux_get_index (GST_ELEMENT (demux));
+   if (index) {
      /* Let's check if we have an index entry for that seek time */
-     entry = gst_index_get_assoc_entry (demux->index, demux->index_id,
+     entry = gst_index_get_assoc_entry (index, demux->index_id,
          GST_INDEX_LOOKUP_BEFORE, GST_ASSOCIATION_FLAG_KEY_UNIT,
          GST_FORMAT_TIME, time);
  
@@@ -2916,9 -2927,13 +2945,10 @@@ gst_flv_demux_sink_event (GstPad * pad
          GST_WARNING_OBJECT (demux, "failed pushing EOS on streams");
        ret = TRUE;
        break;
 -    case GST_EVENT_NEWSEGMENT:
+     }
 +    case GST_EVENT_SEGMENT:
      {
 -      GstFormat format;
 -      gdouble rate;
 -      gint64 start, stop, time;
 -      gboolean update;
 +      GstSegment in_segment;
  
        GST_DEBUG_OBJECT (demux, "received new segment");
  
@@@ -3144,9 -3185,11 +3183,12 @@@ gst_flv_demux_set_index (GstElement * e
    /* object lock might be taken again */
    if (index)
      gst_index_get_writer_id (index, GST_OBJECT (element), &demux->index_id);
    GST_DEBUG_OBJECT (demux, "Set index %" GST_PTR_FORMAT, demux->index);
  
+   gst_object_unref (index);
  }
++#endif
  
  static GstIndex *
  gst_flv_demux_get_index (GstElement * element)
Simple merge