vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / media-add-ons / firewire_dv / FireWireCard.h
blob7caf02c0da8c45e3b025e9813d241de176cf18a4
1 /*
2 * FireWire DV media addon for Haiku
4 * Copyright (c) 2008, JiSheng Zhang (jszhang3@mail.ustc.edu.cn)
5 * Distributed under the terms of the MIT License.
7 */
8 #ifndef __FIREWIRE_CARD_H
9 #define __FIREWIRE_CARD_H
12 #include <SupportDefs.h>
15 class FireWireCard {
16 public:
17 enum fmt_type {
18 FMT_MPEGTS = 0,
19 FMT_DV = 1,
21 FireWireCard(const char* path);
22 ~FireWireCard();
24 status_t InitCheck();
26 status_t DetectRecvFn();
27 ssize_t Read(void** buffer);
28 status_t Extract(void* dest, void** src, ssize_t* sizeUsed);
30 void GetBufInfo(size_t* rbufsize, int* rcount);
32 private:
33 ssize_t DvRead(void** buffer);
34 status_t DvExtract(void* dest, void** src, ssize_t* sizeUsed);
35 ssize_t MpegtsRead(void** buffer);
36 status_t MpegtsExtract(void* dest, void** src,
37 ssize_t* sizeUsed);
39 status_t fInitStatus;
40 int fDev;
41 void* fBuf;
42 void* fPad;
43 size_t fRbufSize;
44 int fRcount;
45 fmt_type fFormat;
49 #endif