About
Contact
QtCreator
KDevelop
Solarized
line #s on
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
<common/qgst_play_p.h>
5
6
QT_BEGIN_NAMESPACE
7
8
namespace
QGstPlaySupport
{
9
10
VideoInfo
parseGstPlayVideoInfo
(
const
GstPlayVideoInfo
*
info
)
11
{
12
VideoInfo
videoInfo
;
13
14
videoInfo
.
bitrate
=
gst_play_video_info_get_bitrate
(
info
);
15
videoInfo
.
maxBitrate
=
gst_play_video_info_get_max_bitrate
(
info
);
16
17
videoInfo
.
size
=
QSize
{
18
gst_play_video_info_get_width
(
info
),
19
gst_play_video_info_get_height
(
info
),
20
};
21
22
{
23
gint
nom
,
denom
;
24
gst_play_video_info_get_framerate
(
info
,
fps_n:
&
nom
,
fps_d:
&
denom
);
25
videoInfo
.
framerate
=
Fraction
{
26
.numerator:
nom
,
27
.denominator:
denom
,
28
};
29
}
30
31
{
32
guint
nom
,
denom
;
33
gst_play_video_info_get_pixel_aspect_ratio
(
info
,
par_n:
&
nom
,
par_d:
&
denom
);
34
videoInfo
.
pixelAspectRatio
=
Fraction
{
35
.numerator:
int
(
nom
),
36
.denominator:
int
(
denom
),
37
};
38
}
39
40
return
videoInfo
;
41
}
42
43
AudioInfo
parseGstPlayAudioInfo
(
const
GstPlayAudioInfo
*
info
)
44
{
45
AudioInfo
audioInfo
;
46
audioInfo
.
channels
=
gst_play_audio_info_get_channels
(
info
);
47
audioInfo
.
sampleRate
=
gst_play_audio_info_get_sample_rate
(
info
);
48
audioInfo
.
bitrate
=
gst_play_audio_info_get_bitrate
(
info
);
49
audioInfo
.
maxBitrate
=
gst_play_audio_info_get_max_bitrate
(
info
);
50
51
audioInfo
.
language
=
QLocale
::
codeToLanguage
(
52
languageCode:
QString
::
fromUtf8
(
utf8:
gst_play_audio_info_get_language
(
info
)),
codeTypes:
QLocale
::
AnyLanguageCode
);
53
54
return
audioInfo
;
55
}
56
57
SubtitleInfo
parseGstPlaySubtitleInfo
(
const
GstPlaySubtitleInfo
*
info
)
58
{
59
SubtitleInfo
subtitleInfo
;
60
61
subtitleInfo
.
language
=
QLocale
::
codeToLanguage
(
62
languageCode:
QString
::
fromUtf8
(
utf8:
gst_play_subtitle_info_get_language
(
info
)),
codeTypes:
QLocale
::
AnyLanguageCode
);
63
64
return
subtitleInfo
;
65
}
66
67
int
getStreamIndex
(
const
GstPlayStreamInfo
*
info
)
68
{
69
if
(
info
==
nullptr
)
70
return
-
1
;
71
72
return
gst_play_stream_info_get_index
(
info
);
73
}
74
75
}
// namespace QGstPlaySupport
76
77
QT_END_NAMESPACE
78
Definitions
parseGstPlayVideoInfo
parseGstPlayAudioInfo
parseGstPlaySubtitleInfo
Learn to use CMake with our Intro Training
Find out more