]> git.sesse.net Git - mlt/blob - src/modules/videostab/tlist.c
Set glsl_supported property to result of init_movit().
[mlt] / src / modules / videostab / tlist.c
1 #include "tlist.h"
2 #include <stdlib.h>
3 #include <string.h>
4
5 tlist* tlist_new(int size){
6     tlist* t=malloc(sizeof(tlist));
7     memset(t,0,sizeof(tlist));
8     return t;
9 }
10
11 void tlist_append(tlist* t,void* data,int size){
12     tlist* next=tlist_new(0);
13     tlist* pos=t;
14     while (pos && pos->next) {
15                 pos=pos->next;
16         }
17
18         pos->data=malloc(size);
19         memcpy(pos->data,data,size);
20     pos->next=next;
21 }
22 int tlist_size(tlist* t){
23     int ret=0;
24     tlist* pos=t;
25     while (pos && pos->next && pos->data) {
26         pos=pos->next ;
27         ret++;
28     };
29     return ret;
30 }
31 void* tlist_pop(tlist* t,int at){
32     int ret=0;
33     tlist* pos=t;
34     /*if (pos && !pos->next ){
35         return pos->data;
36     }*/
37     while (pos && pos->next) {
38         if (ret==at){
39             tlist* n=pos->next;
40             pos->data=n->data;
41             pos->next=n->next;
42             return pos->data;
43         }
44         pos=pos->next ;
45         ret++;
46     };
47     return NULL;
48 }
49 void tlist_fini(tlist* list){
50         tlist* head=list;
51         while (head){
52                 if (head->data) free(head->data);
53                 tlist *del=head;
54                 head=head->next;
55                 free(del);
56         }
57 }