MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / seek

Method seek

framework/data_source/SourceReader.cpp:16–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 }
15
16 int64_t SourceReader::seek(int64_t offset, int whence)
17 {
18 switch (whence) {
19 case SEEK_SIZE:
20 return mSource->getFileSize();
21
22 case SEEK_SET:
23 if (offset >= 0) {
24 mPos = offset;
25 break;
26 } else {
27 return -EINVAL;
28 }
29
30 case SEEK_END:
31 if (mSource->getFileSize() < 0) {
32 return -(ENOSYS);
33 }
34
35 mPos = mSource->getFileSize() + offset;
36 break;
37
38 case SEEK_CUR:
39 mPos += offset;
40 break;
41
42 default:
43 return -EINVAL;
44 }
45
46 return mPos;
47 }
48
49 int SourceReader::read(void *buf, size_t nbyte)
50 {

Callers 1

mainFunction · 0.45

Calls 1

getFileSizeMethod · 0.45

Tested by 1

mainFunction · 0.36