Mercurial > projects > hoofbaby
comparison src/impl/hoofbaby/codec/libav/avbuffer.d @ 0:3425707ddbf6
Initial import (hopefully this mercurial stuff works...)
author | fraserofthenight |
---|---|
date | Mon, 06 Jul 2009 08:06:28 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3425707ddbf6 |
---|---|
1 /** | |
2 * Hoofbaby -- http://www.dsource.org/projects/hoofbaby | |
3 * Copyright (C) 2009 Robert Fraser | |
4 * | |
5 * This program is free software; you can redistribute it andor | |
6 * modify it under the terms of the GNU General Public License | |
7 * as published by the Free Software Foundation; either version 2 | |
8 * of the License, or (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 */ | |
15 | |
16 module hoofbaby.codec.libav.avbuffer; | |
17 | |
18 import hoofbaby.codec.libav.avformat; | |
19 import hoofbaby.util.buffer; | |
20 import tango.stdc.stdlib; | |
21 import tango.stdc.string; | |
22 import tango.stdc.stdio; | |
23 | |
24 ByteIOContext* getBioContext(RingBuffer* buf, int maxPacketSize) | |
25 { | |
26 ByteIOContext* bio = av_alloc_put_byte(cast(char*) malloc(1 << 16), 1 << 16, 1, buf, null, &hoofbaby_avbuffer_write, null); | |
27 if(bio) | |
28 bio.is_streamed = true; | |
29 return bio; | |
30 } | |
31 | |
32 extern(C) int hoofbaby_avbuffer_write(void* _buf, char* data, int size) | |
33 { | |
34 RingBuffer* buf = cast(RingBuffer*) _buf; | |
35 assert(buf); | |
36 void* p = buf.beginWrite(size); | |
37 assert(p); | |
38 memcpy(p, data, size); | |
39 buf.endWrite(size); | |
40 return 0; | |
41 } |