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
fed74c0a
Commit
fed74c0a
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shorten: decode directly to the user-provided AVFrame
parent
5d5c248c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
shorten.c
libavcodec/shorten.c
+5
-9
No files found.
libavcodec/shorten.c
View file @
fed74c0a
...
@@ -80,7 +80,6 @@ static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
...
@@ -80,7 +80,6 @@ static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
typedef
struct
ShortenContext
{
typedef
struct
ShortenContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
frame
;
GetBitContext
gb
;
GetBitContext
gb
;
int
min_framesize
,
max_framesize
;
int
min_framesize
,
max_framesize
;
...
@@ -115,9 +114,6 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx)
...
@@ -115,9 +114,6 @@ static av_cold int shorten_decode_init(AVCodecContext * avctx)
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16P
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16P
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
return
0
;
}
}
...
@@ -408,6 +404,7 @@ static int read_header(ShortenContext *s)
...
@@ -408,6 +404,7 @@ static int read_header(ShortenContext *s)
static
int
shorten_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
shorten_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
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
;
ShortenContext
*
s
=
avctx
->
priv_data
;
ShortenContext
*
s
=
avctx
->
priv_data
;
...
@@ -582,17 +579,16 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -582,17 +579,16 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
s
->
cur_chan
++
;
s
->
cur_chan
++
;
if
(
s
->
cur_chan
==
s
->
channels
)
{
if
(
s
->
cur_chan
==
s
->
channels
)
{
/* get output buffer */
/* get output buffer */
s
->
frame
.
nb_samples
=
s
->
blocksize
;
frame
->
nb_samples
=
s
->
blocksize
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
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
;
}
}
/* interleave output */
/* interleave output */
output_buffer
((
int16_t
**
)
s
->
frame
.
extended_data
,
s
->
channels
,
output_buffer
((
int16_t
**
)
frame
->
extended_data
,
s
->
channels
,
s
->
blocksize
,
s
->
decoded
);
s
->
blocksize
,
s
->
decoded
);
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
}
}
}
}
}
}
...
...
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