~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavutil/fifo.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        f->rptr -= f->end - f->buffer;
128
128
    f->rndx += size;
129
129
}
 
130
 
 
131
#ifdef TEST
 
132
 
 
133
#undef printf
 
134
 
 
135
int main(void)
 
136
{
 
137
    /* create a FIFO buffer */
 
138
    AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int));
 
139
    int i, j, n;
 
140
 
 
141
    /* fill data */
 
142
    for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++)
 
143
        av_fifo_generic_write(fifo, &i, sizeof(int), NULL);
 
144
 
 
145
    /* peek at FIFO */
 
146
    n = av_fifo_size(fifo)/sizeof(int);
 
147
    for (i = -n+1; i < n; i++) {
 
148
        int *v = (int *)av_fifo_peek2(fifo, i*sizeof(int));
 
149
        printf("%d: %d\n", i, *v);
 
150
    }
 
151
    printf("\n");
 
152
 
 
153
    /* read data */
 
154
    for (i = 0; av_fifo_size(fifo) >= sizeof(int); i++) {
 
155
        av_fifo_generic_read(fifo, &j, sizeof(int), NULL);
 
156
        printf("%d ", j);
 
157
    }
 
158
    printf("\n");
 
159
 
 
160
    av_fifo_free(fifo);
 
161
 
 
162
    return 0;
 
163
}
 
164
 
 
165
#endif