index: remove conditional index support

Index support cannot be disabled since commit
4bfb1fe70c6f0d5e29c17a8eeffb02f7fd083f11
in core, which removed the configure flags to disable index.
This commit is contained in:
Stefan Kost 2011-02-21 11:05:31 +02:00
parent 2b9048ede9
commit b3c04da6c3
4 changed files with 3 additions and 35 deletions

View File

@ -100,10 +100,8 @@ static GstFlowReturn gst_mad_chain_reverse (GstMad * mad, GstBuffer * buf);
static GstStateChangeReturn gst_mad_change_state (GstElement * element, static GstStateChangeReturn gst_mad_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
#ifndef GST_DISABLE_INDEX
static void gst_mad_set_index (GstElement * element, GstIndex * index); static void gst_mad_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_mad_get_index (GstElement * element); static GstIndex *gst_mad_get_index (GstElement * element);
#endif
static GstTagList *gst_mad_id3_to_tag_list (const struct id3_tag *tag); static GstTagList *gst_mad_id3_to_tag_list (const struct id3_tag *tag);
@ -200,10 +198,8 @@ gst_mad_class_init (GstMadClass * klass)
gobject_class->dispose = gst_mad_dispose; gobject_class->dispose = gst_mad_dispose;
gstelement_class->change_state = gst_mad_change_state; gstelement_class->change_state = gst_mad_change_state;
#ifndef GST_DISABLE_INDEX
gstelement_class->set_index = gst_mad_set_index; gstelement_class->set_index = gst_mad_set_index;
gstelement_class->get_index = gst_mad_get_index; gstelement_class->get_index = gst_mad_get_index;
#endif
/* init properties */ /* init properties */
/* currently, string representations are used, we might want to change that */ /* currently, string representations are used, we might want to change that */
@ -287,9 +283,7 @@ gst_mad_dispose (GObject * object)
{ {
GstMad *mad = GST_MAD (object); GstMad *mad = GST_MAD (object);
#ifndef GST_DISABLE_INDEX
gst_mad_set_index (GST_ELEMENT (object), NULL); gst_mad_set_index (GST_ELEMENT (object), NULL);
#endif
g_free (mad->tempbuffer); g_free (mad->tempbuffer);
mad->tempbuffer = NULL; mad->tempbuffer = NULL;
@ -301,7 +295,6 @@ gst_mad_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
#ifndef GST_DISABLE_INDEX
static void static void
gst_mad_set_index (GstElement * element, GstIndex * index) gst_mad_set_index (GstElement * element, GstIndex * index)
{ {
@ -320,7 +313,6 @@ gst_mad_get_index (GstElement * element)
return mad->index; return mad->index;
} }
#endif
static gboolean static gboolean
gst_mad_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value, gst_mad_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value,
@ -604,7 +596,6 @@ error:
return FALSE; return FALSE;
} }
#ifndef GST_DISABLE_INDEX
static gboolean static gboolean
index_seek (GstMad * mad, GstPad * pad, GstEvent * event) index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
{ {
@ -681,7 +672,6 @@ index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
return FALSE; return FALSE;
} }
#endif
static gboolean static gboolean
normal_seek (GstMad * mad, GstPad * pad, GstEvent * event) normal_seek (GstMad * mad, GstPad * pad, GstEvent * event)
@ -807,11 +797,9 @@ gst_mad_src_event (GstPad * pad, GstEvent * event)
/* the all-formats seek logic, ref the event, we need it later */ /* the all-formats seek logic, ref the event, we need it later */
gst_event_ref (event); gst_event_ref (event);
if (!(res = gst_pad_push_event (mad->sinkpad, event))) { if (!(res = gst_pad_push_event (mad->sinkpad, event))) {
#ifndef GST_DISABLE_INDEX
if (mad->index) if (mad->index)
res = index_seek (mad, pad, event); res = index_seek (mad, pad, event);
else else
#endif
res = normal_seek (mad, pad, event); res = normal_seek (mad, pad, event);
} }
gst_event_unref (event); gst_event_unref (event);
@ -1672,7 +1660,6 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
GST_SECOND, mad->rate) - time_offset; GST_SECOND, mad->rate) - time_offset;
} }
#ifndef GST_DISABLE_INDEX
if (mad->index) { if (mad->index) {
guint64 x_bytes = mad->base_byte_offset + mad->bytes_consumed; guint64 x_bytes = mad->base_byte_offset + mad->bytes_consumed;
@ -1680,7 +1667,6 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
GST_ASSOCIATION_FLAG_DELTA_UNIT, GST_ASSOCIATION_FLAG_DELTA_UNIT,
GST_FORMAT_BYTES, x_bytes, GST_FORMAT_TIME, time_offset, NULL); GST_FORMAT_BYTES, x_bytes, GST_FORMAT_TIME, time_offset, NULL);
} }
#endif
if (mad->segment_start <= (time_offset == if (mad->segment_start <= (time_offset ==
GST_CLOCK_TIME_NONE ? 0 : time_offset)) { GST_CLOCK_TIME_NONE ? 0 : time_offset)) {

View File

@ -86,10 +86,8 @@ struct _GstMad
gint times_pending; gint times_pending;
gboolean caps_set; /* used to keep track of whether to change/update caps */ gboolean caps_set; /* used to keep track of whether to change/update caps */
#ifndef GST_DISABLE_INDEX
GstIndex *index; GstIndex *index;
gint index_id; gint index_id;
#endif
gboolean check_for_xing; gboolean check_for_xing;
gboolean xing_found; gboolean xing_found;

View File

@ -85,10 +85,8 @@ static void gst_mpeg2dec_init (GstMpeg2dec * mpeg2dec);
static void gst_mpeg2dec_finalize (GObject * object); static void gst_mpeg2dec_finalize (GObject * object);
static void gst_mpeg2dec_reset (GstMpeg2dec * mpeg2dec); static void gst_mpeg2dec_reset (GstMpeg2dec * mpeg2dec);
#ifndef GST_DISABLE_INDEX
static void gst_mpeg2dec_set_index (GstElement * element, GstIndex * index); static void gst_mpeg2dec_set_index (GstElement * element, GstIndex * index);
static GstIndex *gst_mpeg2dec_get_index (GstElement * element); static GstIndex *gst_mpeg2dec_get_index (GstElement * element);
#endif
static gboolean gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event); static gboolean gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event);
static const GstQueryType *gst_mpeg2dec_get_src_query_types (GstPad * pad); static const GstQueryType *gst_mpeg2dec_get_src_query_types (GstPad * pad);
@ -187,10 +185,8 @@ gst_mpeg2dec_class_init (GstMpeg2decClass * klass)
gobject_class->finalize = gst_mpeg2dec_finalize; gobject_class->finalize = gst_mpeg2dec_finalize;
gstelement_class->change_state = gst_mpeg2dec_change_state; gstelement_class->change_state = gst_mpeg2dec_change_state;
#ifndef GST_DISABLE_INDEX
gstelement_class->set_index = gst_mpeg2dec_set_index; gstelement_class->set_index = gst_mpeg2dec_set_index;
gstelement_class->get_index = gst_mpeg2dec_get_index; gstelement_class->get_index = gst_mpeg2dec_get_index;
#endif
} }
static void static void
@ -291,7 +287,6 @@ gst_mpeg2dec_qos_reset (GstMpeg2dec * mpeg2dec)
GST_OBJECT_UNLOCK (mpeg2dec); GST_OBJECT_UNLOCK (mpeg2dec);
} }
#ifndef GST_DISABLE_INDEX
static void static void
gst_mpeg2dec_set_index (GstElement * element, GstIndex * index) gst_mpeg2dec_set_index (GstElement * element, GstIndex * index)
{ {
@ -317,7 +312,6 @@ gst_mpeg2dec_get_index (GstElement * element)
return (mpeg2dec->index) ? gst_object_ref (mpeg2dec->index) : NULL; return (mpeg2dec->index) ? gst_object_ref (mpeg2dec->index) : NULL;
} }
#endif
static GstFlowReturn static GstFlowReturn
gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstBuffer ** buf) gst_mpeg2dec_crop_buffer (GstMpeg2dec * dec, GstBuffer ** buf)
@ -887,7 +881,6 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
picture->nb_fields, GST_BUFFER_OFFSET (outbuf), picture->nb_fields, GST_BUFFER_OFFSET (outbuf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
#ifndef GST_DISABLE_INDEX
if (mpeg2dec->index) { if (mpeg2dec->index) {
gst_index_add_association (mpeg2dec->index, mpeg2dec->index_id, gst_index_add_association (mpeg2dec->index, mpeg2dec->index_id,
(key_frame ? GST_ASSOCIATION_FLAG_KEY_UNIT : (key_frame ? GST_ASSOCIATION_FLAG_KEY_UNIT :
@ -895,7 +888,6 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
GST_FORMAT_BYTES, GST_BUFFER_OFFSET (outbuf), GST_FORMAT_BYTES, GST_BUFFER_OFFSET (outbuf),
GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (outbuf), 0); GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (outbuf), 0);
} }
#endif
if (picture->flags & PIC_FLAG_SKIP) if (picture->flags & PIC_FLAG_SKIP)
goto skip; goto skip;
@ -1248,11 +1240,9 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
break; break;
} }
case GST_EVENT_EOS: case GST_EVENT_EOS:
#ifndef GST_DISABLE_INDEX
if (mpeg2dec->index && mpeg2dec->closed) { if (mpeg2dec->index && mpeg2dec->closed) {
gst_index_commit (mpeg2dec->index, mpeg2dec->index_id); gst_index_commit (mpeg2dec->index, mpeg2dec->index_id);
} }
#endif
ret = gst_pad_push_event (mpeg2dec->srcpad, event); ret = gst_pad_push_event (mpeg2dec->srcpad, event);
break; break;
default: default:
@ -1545,7 +1535,6 @@ gst_mpeg2dec_get_event_masks (GstPad * pad)
} }
#endif #endif
#ifndef GST_DISABLE_INDEX
static gboolean static gboolean
index_seek (GstPad * pad, GstEvent * event) index_seek (GstPad * pad, GstEvent * event)
{ {
@ -1612,7 +1601,6 @@ index_seek (GstPad * pad, GstEvent * event)
} }
return FALSE; return FALSE;
} }
#endif
static gboolean static gboolean
normal_seek (GstPad * pad, GstEvent * event) normal_seek (GstPad * pad, GstEvent * event)
@ -1698,11 +1686,9 @@ gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event)
case GST_EVENT_SEEK:{ case GST_EVENT_SEEK:{
gst_event_ref (event); gst_event_ref (event);
if (!(res = gst_pad_push_event (mpeg2dec->sinkpad, event))) { if (!(res = gst_pad_push_event (mpeg2dec->sinkpad, event))) {
#ifndef GST_DISABLE_INDEX
if (mpeg2dec->index) if (mpeg2dec->index)
res = index_seek (pad, event); res = index_seek (pad, event);
else else
#endif
res = normal_seek (pad, event); res = normal_seek (pad, event);
} }
gst_event_unref (event); gst_event_unref (event);

View File

@ -101,10 +101,8 @@ struct _GstMpeg2dec {
gint fps_d; gint fps_d;
gboolean need_sequence; gboolean need_sequence;
#ifndef GST_DISABLE_INDEX
GstIndex *index; GstIndex *index;
gint index_id; gint index_id;
#endif
gint error_count; gint error_count;
gboolean can_allocate_aligned; gboolean can_allocate_aligned;