Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
862fe417
Commit
862fe417
authored
Feb 26, 2012
by
Sébastien Toque
Browse files
thumbnail: add transparent bars instead of cropping the original image
parent
2835df5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
vlc-android/jni/thumbnailer.c
View file @
862fe417
...
...
@@ -89,13 +89,13 @@ static void thumbnailer_unlock(void *opaque, void *picture, void *const *pixels)
}
/* Else we have received our first thumbnail and we can exit. */
const
char
*
dataSrc
=
sys
->
frameData
+
sys
->
thumbnailOffset
;
char
*
dataDest
=
sys
->
thumbnail
;
const
char
*
dataSrc
=
sys
->
frameData
;
char
*
dataDest
=
sys
->
thumbnail
+
sys
->
thumbnailOffset
;
/* Copy the thumbnail. */
unsigned
i
;
for
(
i
=
0
;
i
<
sys
->
nbLines
;
++
i
)
{
memcpy
(
dataDest
,
dataSrc
,
sys
->
lineSize
);
memcpy
(
dataDest
,
dataSrc
,
sys
->
picPitch
);
dataDest
+=
sys
->
lineSize
;
dataSrc
+=
sys
->
picPitch
;
}
...
...
@@ -174,20 +174,21 @@ jbyteArray Java_org_videolan_vlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
unsigned
picWidth
=
width
;
unsigned
picHeight
=
height
;
float
videoAR
=
(
float
)
videoWidth
/
videoHeight
;
if
(
videoAR
<
((
float
)
width
/
height
))
float
screenAR
=
(
float
)
width
/
height
;
if
(
screenAR
<
videoAR
)
{
picHeight
/
=
videoAR
;
sys
->
thumbnailOffset
=
(
picH
eight
-
h
eight
)
/
2
*
sys
->
picPitch
;
picHeight
=
(
float
)
width
/
videoAR
;
sys
->
thumbnailOffset
=
(
h
eight
-
picH
eight
)
/
2
*
width
*
PIXEL_SIZE
;
}
else
{
picWidth
*
=
videoAR
;
sys
->
thumbnailOffset
=
(
picW
idth
-
w
idth
)
/
2
*
PIXEL_SIZE
;
picWidth
=
(
float
)
height
*
videoAR
;
sys
->
thumbnailOffset
=
(
w
idth
-
picW
idth
)
/
2
*
PIXEL_SIZE
;
}
sys
->
picPitch
=
picWidth
*
PIXEL_SIZE
;
sys
->
lineSize
=
width
*
PIXEL_SIZE
;
sys
->
nbLines
=
h
eight
;
sys
->
nbLines
=
picH
eight
;
/* Allocate the memory to store the frames. */
unsigned
picSize
=
sys
->
picPitch
*
picHeight
;
...
...
@@ -200,7 +201,7 @@ jbyteArray Java_org_videolan_vlc_LibVLC_getThumbnail(JNIEnv *env, jobject thiz,
/* Allocate the memory to store the thumbnail. */
unsigned
thumbnailSize
=
width
*
height
*
PIXEL_SIZE
;
sys
->
thumbnail
=
m
alloc
(
thumbnailSize
);
sys
->
thumbnail
=
c
alloc
(
thumbnailSize
,
1
);
if
(
sys
->
thumbnail
==
NULL
)
{
LOGE
(
"Couldn't allocate the memory to store the thumbnail!"
);
...
...
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