Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
46f782a9
Commit
46f782a9
authored
Jul 26, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
araw: zero copy for native audio sample formats
parent
492dfdd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
32 deletions
+25
-32
modules/codec/araw.c
modules/codec/araw.c
+25
-32
No files found.
modules/codec/araw.c
View file @
46f782a9
...
...
@@ -297,10 +297,13 @@ static int DecoderOpen( vlc_object_t *p_this )
static
block_t
*
DecodeBlock
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
!
pp_block
||
!*
pp_block
)
return
NULL
;
if
(
pp_block
==
NULL
)
return
NULL
;
block_t
*
p_block
=
*
pp_block
;
if
(
p_block
==
NULL
)
return
NULL
;
*
pp_block
=
NULL
;
if
(
p_block
->
i_pts
>
VLC_TS_INVALID
&&
p_block
->
i_pts
!=
date_Get
(
&
p_sys
->
end_date
)
)
...
...
@@ -308,47 +311,37 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
date_Set
(
&
p_sys
->
end_date
,
p_block
->
i_pts
);
}
else
if
(
!
date_Get
(
&
p_sys
->
end_date
)
)
{
/* We've just started the stream, wait for the first PTS. */
block_Release
(
p_block
);
return
NULL
;
}
/* Don't re-use the same pts twice */
p_block
->
i_pts
=
VLC_TS_INVALID
;
goto
skip
;
unsigned
samples
=
(
8
*
p_block
->
i_buffer
)
/
p_sys
->
framebits
;
if
(
samples
==
0
)
{
block_Release
(
p_block
);
return
NULL
;
}
goto
skip
;
/* Create chunks of max 1024 samples */
if
(
samples
>
1024
)
samples
=
1024
;
block_t
*
p_out
=
decoder_NewAudioBuffer
(
p_dec
,
samples
);
if
(
p_out
==
NULL
)
if
(
p_sys
->
decode
!=
NULL
)
{
block_Release
(
p_block
);
return
NULL
;
}
p_out
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_out
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
samples
)
-
p_out
->
i_pts
;
block_t
*
p_out
=
decoder_NewAudioBuffer
(
p_dec
,
samples
);
if
(
p_out
==
NULL
)
goto
skip
;
if
(
p_sys
->
decode
!=
NULL
)
p_sys
->
decode
(
p_out
->
p_buffer
,
p_block
->
p_buffer
,
samples
*
p_dec
->
fmt_in
.
audio
.
i_channels
);
block_Release
(
p_block
);
p_block
=
p_out
;
}
else
memcpy
(
p_out
->
p_buffer
,
p_block
->
p_buffer
,
p_out
->
i_buffer
);
samples
=
(
samples
*
p_sys
->
framebits
)
/
8
;
p_block
->
p_buffer
+=
samples
;
p_block
->
i_buffer
-=
samples
;
{
decoder_UpdateAudioFormat
(
p_dec
);
p_block
->
i_buffer
=
samples
*
(
p_sys
->
framebits
/
8
);
}
return
p_out
;
p_block
->
i_pts
=
date_Get
(
&
p_sys
->
end_date
);
p_block
->
i_length
=
date_Increment
(
&
p_sys
->
end_date
,
samples
)
-
p_block
->
i_pts
;
return
p_block
;
skip:
block_Release
(
p_block
);
return
NULL
;
}
static
void
S8Decode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
...
...
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