Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qffmpegioutils.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qffmpegioutils_p.h"
5
#
include
"qiodevice.h"
6
#
include
"qffmpegdefs_p.h"
7
8
QT_BEGIN_NAMESPACE
9
10
namespace
QFFmpeg
{
11
12
int
readQIODevice(
void
*opaque, uint8_t *buf,
int
buf_size)
13
{
14
auto
*dev =
static_cast
<QIODevice *>(opaque);
15
Q_ASSERT(dev);
16
17
if
(dev->atEnd())
18
return
AVERROR_EOF;
19
return
dev->read(
reinterpret_cast
<
char
*>(buf), buf_size);
20
}
21
22
int
writeQIODevice
(
void
*opaque, AvioWriteBufferType buf,
int
buf_size)
23
{
24
auto
dev =
static_cast
<QIODevice *>(opaque);
25
Q_ASSERT(dev);
26
27
return
dev->write(
reinterpret_cast
<
const
char
*>(buf), buf_size);
28
}
29
30
int64_t seekQIODevice(
void
*opaque, int64_t offset,
int
whence)
31
{
32
QIODevice *dev =
static_cast
<QIODevice *>(opaque);
33
Q_ASSERT(dev);
34
35
if
(dev->isSequential())
36
return
AVERROR(EINVAL);
37
38
if
(whence & AVSEEK_SIZE)
39
return
dev->size();
40
41
whence &= ~AVSEEK_FORCE;
42
43
if
(whence == SEEK_CUR)
44
offset += dev->pos();
45
else
if
(whence == SEEK_END)
46
offset += dev->size();
47
48
if
(!dev->seek(offset))
49
return
AVERROR(EINVAL);
50
return
offset;
51
}
52
53
}
// namespace QFFmpeg
54
55
QT_END_NAMESPACE
QFFmpeg
Definition
qandroidcacertificates.cpp:26
QFFmpeg::writeQIODevice
int writeQIODevice(void *opaque, AvioWriteBufferType buf, int buf_size)
Definition
qffmpegioutils.cpp:22
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
Definition
qtconfigmacros.h:161
QT_END_NAMESPACE
#define QT_END_NAMESPACE
Definition
qtconfigmacros.h:162
qtmultimedia
src
plugins
multimedia
ffmpeg
qffmpegioutils.cpp
Generated on
for Qt by
1.16.1