Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
2cced2a8
Commit
2cced2a8
authored
Feb 13, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paf: decode directly to the user-provided AVFrame
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
9145818e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
paf.c
libavcodec/paf.c
+4
-14
No files found.
libavcodec/paf.c
View file @
2cced2a8
...
...
@@ -377,22 +377,14 @@ static av_cold int paf_vid_close(AVCodecContext *avctx)
return
0
;
}
typedef
struct
PAFAudioDecContext
{
AVFrame
frame
;
}
PAFAudioDecContext
;
static
av_cold
int
paf_aud_init
(
AVCodecContext
*
avctx
)
{
PAFAudioDecContext
*
c
=
avctx
->
priv_data
;
if
(
avctx
->
channels
!=
2
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid number of channels
\n
"
);
return
AVERROR_INVALIDDATA
;
}
avcodec_get_frame_defaults
(
&
c
->
frame
);
avctx
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
avctx
->
coded_frame
=
&
c
->
frame
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
return
0
;
...
...
@@ -401,7 +393,7 @@ static av_cold int paf_aud_init(AVCodecContext *avctx)
static
int
paf_aud_decode
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
pkt
)
{
PAFAudioDecContext
*
c
=
avctx
->
priv_
data
;
AVFrame
*
frame
=
data
;
uint8_t
*
buf
=
pkt
->
data
;
int16_t
*
output_samples
;
const
uint8_t
*
t
;
...
...
@@ -411,11 +403,11 @@ static int paf_aud_decode(AVCodecContext *avctx, void *data,
if
(
frames
<
1
)
return
AVERROR_INVALIDDATA
;
c
->
frame
.
nb_samples
=
PAF_SOUND_SAMPLES
*
frames
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
c
->
frame
))
<
0
)
frame
->
nb_samples
=
PAF_SOUND_SAMPLES
*
frames
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
return
ret
;
output_samples
=
(
int16_t
*
)
c
->
frame
.
data
[
0
];
output_samples
=
(
int16_t
*
)
frame
->
data
[
0
];
for
(
i
=
0
;
i
<
frames
;
i
++
)
{
t
=
buf
+
256
*
sizeof
(
uint16_t
);
for
(
j
=
0
;
j
<
PAF_SOUND_SAMPLES
;
j
++
)
{
...
...
@@ -428,7 +420,6 @@ static int paf_aud_decode(AVCodecContext *avctx, void *data,
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
c
->
frame
;
return
pkt
->
size
;
}
...
...
@@ -449,7 +440,6 @@ AVCodec ff_paf_audio_decoder = {
.
name
=
"paf_audio"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
id
=
AV_CODEC_ID_PAF_AUDIO
,
.
priv_data_size
=
sizeof
(
PAFAudioDecContext
),
.
init
=
paf_aud_init
,
.
decode
=
paf_aud_decode
,
.
capabilities
=
CODEC_CAP_DR1
,
...
...
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