Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
7936b1b4
Commit
7936b1b4
authored
Oct 23, 2019
by
Jean-Baptiste Mardelle
Browse files
improve audio stream description in clip properties
parent
99d0dde2
Pipeline
#9368
passed with stage
in 26 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mltcontroller/clippropertiescontroller.cpp
View file @
7936b1b4
...
...
@@ -609,16 +609,17 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
hlay
->
addWidget
(
new
QLabel
(
i18n
(
"Audio stream"
)));
auto
*
audioStream
=
new
QComboBox
(
this
);
int
ix
=
1
;
for
(
int
stream
:
m_audioStreams
)
{
audioStream
->
addItem
(
i18n
(
"Audio stream %1"
,
ix
),
stream
);
ix
++
;
QMapIterator
<
int
,
QString
>
i
(
m_audioStreams
);
while
(
i
.
hasNext
())
{
i
.
next
();
audioStream
->
addItem
(
QString
(
"%1: %2"
).
arg
(
i
.
key
()).
arg
(
i
.
value
()),
i
.
key
());
}
if
(
!
vix
.
isEmpty
()
&&
vix
.
toInt
()
>
-
1
)
{
audioStream
->
setCurrentIndex
(
audioStream
->
findData
(
QVariant
(
vix
)));
}
ac
->
setActive
(
vix
.
toInt
()
==
-
1
);
audioStream
->
setEnabled
(
vix
.
toInt
()
>
-
1
);
audioStream
->
setVisible
(
m_audioStreams
.
size
()
>
1
);
audioStream
->
setVisible
(
m_audioStreams
.
size
()
>
0
);
connect
(
ac
,
&
KDualAction
::
activeChanged
,
[
this
,
audioStream
](
bool
activated
)
{
QMap
<
QString
,
QString
>
properties
;
int
vindx
=
-
1
;
...
...
@@ -982,7 +983,36 @@ void ClipPropertiesController::fillProperties()
if
(
type
==
QLatin1String
(
"video"
))
{
m_videoStreams
<<
ix
;
}
else
if
(
type
==
QLatin1String
(
"audio"
))
{
m_audioStreams
<<
ix
;
memset
(
property
,
0
,
200
);
snprintf
(
property
,
sizeof
(
property
),
"meta.media.%d.codec.channels"
,
ix
);
int
chan
=
m_sourceProperties
.
get_int
(
property
);
QString
channelDescription
;
switch
(
chan
)
{
case
1
:
channelDescription
=
i18n
(
"Mono "
);
break
;
case
2
:
channelDescription
=
i18n
(
"Stereo "
);
break
;
default:
channelDescription
=
i18n
(
"%1 channels "
,
chan
);
break
;
}
// Frequency
memset
(
property
,
0
,
200
);
snprintf
(
property
,
sizeof
(
property
),
"meta.media.%d.codec.sample_rate"
,
ix
);
QString
frequency
(
m_sourceProperties
.
get
(
property
));
if
(
frequency
.
endsWith
(
QLatin1String
(
"000"
)))
{
frequency
.
chop
(
3
);
frequency
.
append
(
i18n
(
"kHz "
));
}
else
{
frequency
.
append
(
i18n
(
"Hz "
));
}
channelDescription
.
append
(
frequency
);
memset
(
property
,
0
,
200
);
snprintf
(
property
,
sizeof
(
property
),
"meta.media.%d.codec.name"
,
ix
);
channelDescription
.
append
(
m_sourceProperties
.
get
(
property
));
m_audioStreams
.
insert
(
ix
,
channelDescription
);
}
}
m_clipProperties
.
insert
(
QStringLiteral
(
"default_video"
),
QString
::
number
(
vindex
));
...
...
src/mltcontroller/clippropertiescontroller.h
View file @
7936b1b4
...
...
@@ -102,7 +102,7 @@ private:
QMap
<
QString
,
QString
>
m_originalProperties
;
QMap
<
QString
,
QString
>
m_clipProperties
;
QList
<
int
>
m_videoStreams
;
Q
List
<
int
>
m_audioStreams
;
Q
Map
<
int
,
QString
>
m_audioStreams
;
QTreeWidget
*
m_propertiesTree
;
QWidget
*
m_propertiesPage
;
QWidget
*
m_markersPage
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment