mediastreamer2 2.12.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Functions
Ms_list

## Functions
MSList * | ms_list_append (MSList *list, void *data)
MSList * | ms_list_append_link (MSList *list, MSList *new_elem)
MSList * | ms_list_prepend (MSList *list, void *data)
MSList * | ms_list_free (MSList *list)
MSList * | ms_list_free_with_data (MSList *list, void(*freefunc)(void *))
MSList * | ms_list_concat (MSList *first, MSList *second)
MSList * | ms_list_remove (MSList *list, void *data)
MSList * | ms_list_remove_custom (MSList *list, MSCompareFunc compare_func, const void *user_data)
int | ms_list_size (const MSList *list)
void | ms_list_for_each (const MSList *list, MSIterateFunc iterate_func)
void | ms_list_for_each2 (const MSList *list, MSIterate2Func iterate_func, void *user_data)
MSList * | ms_list_remove_link (MSList *list, MSList *elem)
MSList * | ms_list_find (MSList *list, void *data)
MSList * | ms_list_find_custom (MSList *list, MSCompareFunc compare_func, const void *user_data)
void * | ms_list_nth_data (const MSList *list, int index)
int | ms_list_position (const MSList *list, MSList *elem)
int | ms_list_index (const MSList *list, void *data)
MSList * | ms_list_insert_sorted (MSList *list, void *data, MSCompareFunc compare_func)
MSList * | ms_list_insert (MSList *list, MSList *before, void *data)
MSList * | ms_list_copy (const MSList *list)
MSList * | ms_list_copy_with_data (const MSList *list, void *(*copyfunc)(void *))

## Detailed Description

## Function Documentation

MSList* ms_list_append | ( | MSList * | list,
|  | void * | data
| ) |  |

Inserts a new element containing data to the end of a given list

Parameters

  list | list where data should be added. If NULL, a new list will be created.
  data | data to insert into the list

Returns
  first element of the list

MSList* ms_list_append_link | ( | MSList * | list,
|  | MSList * | new_elem
| ) |  |

Inserts given element to the end of a given list

Parameters

  list | list where data should be added. If NULL, a new list will be created.
  new_elem | element to append

Returns
  first element of the list

MSList* ms_list_prepend | ( | MSList * | list,
|  | void * | data
| ) |  |

Inserts a new element containing data to the start of a given list

Parameters

  list | list where data should be added. If NULL, a new list will be created.
  data | data to insert into the list

Returns
  first element of the list - the one which was just created.

MSList* ms_list_free | ( | MSList * | list | ) |

Frees all elements of a given list Note that data contained in each element will not be freed. If you need to clean them, consider using

Parameters

  list | object to free.

Returns
  NULL

MSList* ms_list_free_with_data | ( | MSList * | list,
|  | void(*)(void *) | freefunc
| ) |  |

Frees all elements of a given list after having called freefunc on each element

Parameters

  list | object to free.
  freefunc | function to invoke on each element data before destroying the element

Returns
  NULL

MSList* ms_list_concat | ( | MSList * | first,
|  | MSList * | second
| ) |  |

Concatenates second list to the end of first list

Parameters

  first | First list
  second | Second list to append at the end of first list.

Returns
  first element of the merged list

MSList* ms_list_remove | ( | MSList * | list,
|  | void * | data
| ) |  |

Finds and remove the first element containing the given data. Nothing is done if element is not found.

Parameters

  list | List in which data must be removed
  data | Data to remove

Returns
  first element of the modified list

MSList* ms_list_remove_custom | ( | MSList * | list,
|  | MSCompareFunc | compare_func,
|  | const void * | user_data
| ) |  |

Finds and remove any elements according to the given predicate function

Parameters

  list | List in which data must be removed
  compare_func | Function to invoke on each element. If it returns TRUE, the given element will be deleted.
  user_data | User data to pass to compare_func function

Returns
  first element of the modified list

int ms_list_size | ( | const MSList * | list | ) |

Returns size of a given list

Parameters

  list | List to measure

Returns
  Size of list

void ms_list_for_each | ( | const MSList * | list,
|  | MSIterateFunc | iterate_func
| ) |  |

Invoke function on each element of the list

Parameters

  list | List object
  iterate_func | Function to invoke on each element.

void ms_list_for_each2 | ( | const MSList * | list,
|  | MSIterate2Func | iterate_func,
|  | void * | user_data
| ) |  |

Invoke function on each element of the list

Parameters

  list | List object
  iterate_func | Function to invoke on each element.
  user_data | User data to pass to iterate_func function.

MSList* ms_list_remove_link | ( | MSList * | list,
|  | MSList * | elem
| ) |  |

Finds and remove given element in list.

Parameters

  list | List in which element must be removed
  element | element to remove

Returns
  first element of the modified list

MSList* ms_list_find | ( | MSList * | list,
|  | void * | data
| ) |  |

Finds first element containing data in the given list.

Parameters

  list | List in which element must be found
  data | data to find

Returns
  element containing data, or NULL if not found

MSList* ms_list_find_custom | ( | MSList * | list,
|  | MSCompareFunc | compare_func,
|  | const void * | user_data
| ) |  |

Finds first element according to the given predicate function

Parameters

  list | List in which element must be found
  compare_func | Function to invoke on each element. If it returns TRUE, the given element will be returned.
  user_data | User data to pass to compare_func function

Returns
  Element matching the predicate, or NULL if none is found.

void* ms_list_nth_data | ( | const MSList * | list,
|  | int | index
| ) |  |

Returns the nth element data of the list

Parameters

  list | List object
  index | data index which must be returned.

Returns
  Element at the given index. NULL if index is invalid (negative or greater or equal to ms_list_size).

int ms_list_position | ( | const MSList * | list,
|  | MSList * | elem
| ) |  |

Returns the index of the given element

Parameters

  list | List object
  elem | Element to search for.

Returns
  Index of the given element. -1 if not found.

int ms_list_index | ( | const MSList * | list,
|  | void * | data
| ) |  |

Returns the index of the first element containing data

Parameters

  list | List object
  data | Data to search for.

Returns
  Index of the element containing data. -1 if not found.

MSList* ms_list_insert_sorted | ( | MSList * | list,
|  | void * | data,
|  | MSCompareFunc | compare_func
| ) |  |

Inserts a new element containing data at the place given by compare_func

Parameters

  list | list where data should be added. If NULL, a new list will be created.
  data | data to insert into the list
  compare_func | function determining where should the new element be placed

Returns
  first element of the list.

MSList* ms_list_insert | ( | MSList * | list,
|  | MSList * | before,
|  | void * | data
| ) |  |

Inserts a new element containing data before the given element

Parameters

  list | list where data should be added. If NULL, a new list will be created.
  before | element parent to the one we will insert.
  data | data to insert into the list

Returns
  first element of the modified list.

MSList* ms_list_copy | ( | const MSList * | list | ) |

Copies a list in another one, duplicating elements but not data

Parameters

  list | list to copy

Returns
  Newly created list

MSList* ms_list_copy_with_data | ( | const MSList * | list,
|  | void *(*)(void *) | copyfunc
| ) |  |

Copies a list in another one, duplicating elements according to the given function

Parameters

  list | list to copy
  copyfunc | function to invoke on each element which will return the new list data value

Returns
  Newly created list