Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
5e43f7fc
Commit
5e43f7fc
authored
Sep 14, 2009
by
Hugo Beauzee-Luyssen
Browse files
Code simplification
parent
82a87bc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Media/Clip.cpp
View file @
5e43f7fc
...
...
@@ -29,7 +29,7 @@
#include
"Clip.h"
Clip
::
Clip
(
Media
*
parent
)
:
m_parent
(
parent
),
m_begin
(
0
),
m_end
(
-
1
)
Clip
::
Clip
(
Media
*
parent
)
:
m_parent
(
parent
),
m_begin
(
0
),
m_end
(
parent
->
getNbFrames
()
)
{
m_Uuid
=
QUuid
::
createUuid
();
computeLength
();
...
...
@@ -43,7 +43,7 @@ Clip::Clip( Clip* creator, qint64 begin, qint64 end ) : m_parent( creator->getPa
Clip
::
Clip
(
Media
*
parent
,
qint64
begin
,
qint64
end
)
:
m_parent
(
parent
),
m_begin
(
begin
),
m_end
(
end
)
{
Q_ASSERT
(
parent
->
getInputType
()
==
Media
::
File
||
(
begin
==
0
&&
end
==
-
1
)
);
Q_ASSERT
(
parent
->
getInputType
()
==
Media
::
File
||
(
begin
==
0
&&
end
==
m_parent
->
getNbFrames
()
)
);
m_Uuid
=
QUuid
::
createUuid
();
computeLength
();
}
...
...
@@ -105,19 +105,11 @@ void Clip::computeLength()
{
if
(
m_parent
->
getInputType
()
==
Media
::
File
)
{
if
(
m_end
==
-
1
)
{
m_lengthSeconds
=
m_parent
->
getLength
()
/
1000
;
m_length
=
m_parent
->
getnbFrames
();
}
else
{
unsigned
int
fps
=
m_parent
->
getFps
();
if
(
fps
<
0.1
f
)
fps
=
FPS
;
m_lengthSeconds
=
(
m_end
-
m_begin
)
/
1000
;
m_length
=
m_lengthSeconds
*
fps
;
}
unsigned
int
fps
=
m_parent
->
getFps
();
if
(
fps
<
0.1
f
)
fps
=
FPS
;
m_length
=
m_end
-
m_begin
;
m_lengthSeconds
=
m_length
*
fps
;
emit
lengthUpdated
();
}
else
...
...
@@ -178,7 +170,6 @@ void Clip::setBegin( qint64 begin )
void
Clip
::
setEnd
(
qint64
end
)
{
Q_ASSERT
(
end
<=
1.0
f
);
if
(
end
==
m_end
)
return
;
m_end
=
end
;
computeLength
();
...
...
@@ -198,6 +189,6 @@ Clip* Clip::split( qint64 endFrame )
{
//FIXME the conversion *breaks* clip spliting
//But we don't have any other choice for now, VLC only support float positions!
float
newEnd
=
(
float
)
endFrame
/
m_parent
->
get
n
bFrames
();
float
newEnd
=
(
float
)
endFrame
/
m_parent
->
get
N
bFrames
();
return
split
(
newEnd
);
}
src/Media/Media.cpp
View file @
5e43f7fc
...
...
@@ -236,7 +236,7 @@ void Media::setNbFrames( qint64 nbFrames )
m_nbFrames
=
nbFrames
;
}
qint64
Media
::
get
n
bFrames
()
const
qint64
Media
::
get
N
bFrames
()
const
{
return
m_nbFrames
;
}
src/Media/Media.h
View file @
5e43f7fc
...
...
@@ -116,7 +116,7 @@ public:
float
getFps
()
const
;
void
setFps
(
float
fps
);
qint64
get
n
bFrames
()
const
;
qint64
get
N
bFrames
()
const
;
const
QUuid
&
getUuid
()
const
;
void
setUuid
(
const
QUuid
&
uuid
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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