Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f3107535
Commit
f3107535
authored
Jul 24, 2014
by
Thomas Guillem
Committed by
Martin Storsjö
Jul 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iomx: implement OMX_UseBuffer
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
b7eac9ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
modules/codec/omxil/iomx.cpp
modules/codec/omxil/iomx.cpp
+36
-0
No files found.
modules/codec/omxil/iomx.cpp
View file @
f3107535
...
@@ -31,6 +31,10 @@
...
@@ -31,6 +31,10 @@
#define PREFIX(x) I ## x
#define PREFIX(x) I ## x
#if ANDROID_API >= 11
#define HAS_USE_BUFFER
#endif
using
namespace
android
;
using
namespace
android
;
class
IOMXContext
{
class
IOMXContext
{
...
@@ -76,6 +80,9 @@ public:
...
@@ -76,6 +80,9 @@ public:
class
OMXBuffer
{
class
OMXBuffer
{
public:
public:
sp
<
MemoryDealer
>
dealer
;
sp
<
MemoryDealer
>
dealer
;
#ifdef HAS_USE_BUFFER
sp
<
GraphicBuffer
>
graphicBuffer
;
#endif
IOMX
::
buffer_id
id
;
IOMX
::
buffer_id
id
;
};
};
...
@@ -162,6 +169,9 @@ static OMX_ERRORTYPE iomx_allocate_buffer(OMX_HANDLETYPE component, OMX_BUFFERHE
...
@@ -162,6 +169,9 @@ static OMX_ERRORTYPE iomx_allocate_buffer(OMX_HANDLETYPE component, OMX_BUFFERHE
{
{
OMXNode
*
node
=
(
OMXNode
*
)
((
OMX_COMPONENTTYPE
*
)
component
)
->
pComponentPrivate
;
OMXNode
*
node
=
(
OMXNode
*
)
((
OMX_COMPONENTTYPE
*
)
component
)
->
pComponentPrivate
;
OMXBuffer
*
info
=
new
OMXBuffer
;
OMXBuffer
*
info
=
new
OMXBuffer
;
#ifdef HAS_USE_BUFFER
info
->
graphicBuffer
=
NULL
;
#endif
info
->
dealer
=
new
MemoryDealer
(
size
+
4096
);
// Do we need to keep this around, or is it kept alive via the IMemory that references it?
info
->
dealer
=
new
MemoryDealer
(
size
+
4096
);
// Do we need to keep this around, or is it kept alive via the IMemory that references it?
sp
<
IMemory
>
mem
=
info
->
dealer
->
allocate
(
size
);
sp
<
IMemory
>
mem
=
info
->
dealer
->
allocate
(
size
);
int
ret
=
ctx
->
iomx
->
allocateBufferWithBackup
(
node
->
node
,
port_index
,
mem
,
&
info
->
id
);
int
ret
=
ctx
->
iomx
->
allocateBufferWithBackup
(
node
->
node
,
port_index
,
mem
,
&
info
->
id
);
...
@@ -177,6 +187,27 @@ static OMX_ERRORTYPE iomx_allocate_buffer(OMX_HANDLETYPE component, OMX_BUFFERHE
...
@@ -177,6 +187,27 @@ static OMX_ERRORTYPE iomx_allocate_buffer(OMX_HANDLETYPE component, OMX_BUFFERHE
return
OMX_ErrorNone
;
return
OMX_ErrorNone
;
}
}
#ifdef HAS_USE_BUFFER
static
OMX_ERRORTYPE
iomx_use_buffer
(
OMX_HANDLETYPE
component
,
OMX_BUFFERHEADERTYPE
**
bufferptr
,
OMX_U32
port_index
,
OMX_PTR
app_private
,
OMX_U32
size
,
OMX_U8
*
data
)
{
OMXNode
*
node
=
(
OMXNode
*
)
((
OMX_COMPONENTTYPE
*
)
component
)
->
pComponentPrivate
;
OMXBuffer
*
info
=
new
OMXBuffer
;
info
->
dealer
=
NULL
;
info
->
graphicBuffer
=
new
GraphicBuffer
((
ANativeWindowBuffer
*
)
data
,
false
);
int
ret
=
ctx
->
iomx
->
useGraphicBuffer
(
node
->
node
,
port_index
,
info
->
graphicBuffer
,
&
info
->
id
);
if
(
ret
!=
OK
)
return
OMX_ErrorUndefined
;
OMX_BUFFERHEADERTYPE
*
buffer
=
(
OMX_BUFFERHEADERTYPE
*
)
calloc
(
1
,
sizeof
(
OMX_BUFFERHEADERTYPE
));
*
bufferptr
=
buffer
;
buffer
->
pPlatformPrivate
=
info
;
buffer
->
pAppPrivate
=
app_private
;
buffer
->
nAllocLen
=
size
;
buffer
->
pBuffer
=
data
;
node
->
buffers
.
push_back
(
buffer
);
return
OMX_ErrorNone
;
}
#endif
static
OMX_ERRORTYPE
iomx_free_buffer
(
OMX_HANDLETYPE
component
,
OMX_U32
port
,
OMX_BUFFERHEADERTYPE
*
buffer
)
static
OMX_ERRORTYPE
iomx_free_buffer
(
OMX_HANDLETYPE
component
,
OMX_U32
port
,
OMX_BUFFERHEADERTYPE
*
buffer
)
{
{
OMXNode
*
node
=
(
OMXNode
*
)
((
OMX_COMPONENTTYPE
*
)
component
)
->
pComponentPrivate
;
OMXNode
*
node
=
(
OMXNode
*
)
((
OMX_COMPONENTTYPE
*
)
component
)
->
pComponentPrivate
;
...
@@ -270,6 +301,11 @@ OMX_ERRORTYPE PREFIX(OMX_GetHandle)(OMX_HANDLETYPE *handle_ptr, OMX_STRING compo
...
@@ -270,6 +301,11 @@ OMX_ERRORTYPE PREFIX(OMX_GetHandle)(OMX_HANDLETYPE *handle_ptr, OMX_STRING compo
component
->
FillThisBuffer
=
iomx_fill_this_buffer
;
component
->
FillThisBuffer
=
iomx_fill_this_buffer
;
component
->
GetState
=
iomx_get_state
;
component
->
GetState
=
iomx_get_state
;
component
->
AllocateBuffer
=
iomx_allocate_buffer
;
component
->
AllocateBuffer
=
iomx_allocate_buffer
;
#ifdef HAS_USE_BUFFER
component
->
UseBuffer
=
iomx_use_buffer
;
#else
component
->
UseBuffer
=
NULL
;
#endif
component
->
ComponentRoleEnum
=
iomx_component_role_enum
;
component
->
ComponentRoleEnum
=
iomx_component_role_enum
;
component
->
GetExtensionIndex
=
iomx_get_extension_index
;
component
->
GetExtensionIndex
=
iomx_get_extension_index
;
component
->
SetConfig
=
iomx_set_config
;
component
->
SetConfig
=
iomx_set_config
;
...
...
Write
Preview
Markdown
is supported
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