Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
e42e5a89
Commit
e42e5a89
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bmvaudio: decode directly to the user-provided AVFrame
parent
a6bb39ad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
15 deletions
+4
-15
bmv.c
libavcodec/bmv.c
+4
-15
No files found.
libavcodec/bmv.c
View file @
e42e5a89
...
@@ -295,32 +295,23 @@ static av_cold int decode_end(AVCodecContext *avctx)
...
@@ -295,32 +295,23 @@ static av_cold int decode_end(AVCodecContext *avctx)
return
0
;
return
0
;
}
}
typedef
struct
BMVAudioDecContext
{
AVFrame
frame
;
}
BMVAudioDecContext
;
static
const
int
bmv_aud_mults
[
16
]
=
{
static
const
int
bmv_aud_mults
[
16
]
=
{
16512
,
8256
,
4128
,
2064
,
1032
,
516
,
258
,
192
,
129
,
88
,
64
,
56
,
48
,
40
,
36
,
32
16512
,
8256
,
4128
,
2064
,
1032
,
516
,
258
,
192
,
129
,
88
,
64
,
56
,
48
,
40
,
36
,
32
};
};
static
av_cold
int
bmv_aud_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
bmv_aud_decode_init
(
AVCodecContext
*
avctx
)
{
{
BMVAudioDecContext
*
c
=
avctx
->
priv_data
;
avctx
->
channels
=
2
;
avctx
->
channels
=
2
;
avctx
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
avctx
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avcodec_get_frame_defaults
(
&
c
->
frame
);
avctx
->
coded_frame
=
&
c
->
frame
;
return
0
;
return
0
;
}
}
static
int
bmv_aud_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
bmv_aud_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
BMVAudioDecContext
*
c
=
avctx
->
priv_
data
;
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
int
blocks
=
0
,
total_blocks
,
i
;
int
blocks
=
0
,
total_blocks
,
i
;
...
@@ -336,12 +327,12 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -336,12 +327,12 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
}
}
/* get output buffer */
/* get output buffer */
c
->
frame
.
nb_samples
=
total_blocks
*
32
;
frame
->
nb_samples
=
total_blocks
*
32
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
c
->
frame
))
<
0
)
{
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
return
ret
;
}
}
output_samples
=
(
int16_t
*
)
c
->
frame
.
data
[
0
];
output_samples
=
(
int16_t
*
)
frame
->
data
[
0
];
for
(
blocks
=
0
;
blocks
<
total_blocks
;
blocks
++
)
{
for
(
blocks
=
0
;
blocks
<
total_blocks
;
blocks
++
)
{
uint8_t
code
=
*
buf
++
;
uint8_t
code
=
*
buf
++
;
...
@@ -355,7 +346,6 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -355,7 +346,6 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
}
}
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
c
->
frame
;
return
buf_size
;
return
buf_size
;
}
}
...
@@ -376,7 +366,6 @@ AVCodec ff_bmv_audio_decoder = {
...
@@ -376,7 +366,6 @@ AVCodec ff_bmv_audio_decoder = {
.
name
=
"bmv_audio"
,
.
name
=
"bmv_audio"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
id
=
AV_CODEC_ID_BMV_AUDIO
,
.
id
=
AV_CODEC_ID_BMV_AUDIO
,
.
priv_data_size
=
sizeof
(
BMVAudioDecContext
),
.
init
=
bmv_aud_decode_init
,
.
init
=
bmv_aud_decode_init
,
.
decode
=
bmv_aud_decode_frame
,
.
decode
=
bmv_aud_decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
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