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
e01e1a46
Commit
e01e1a46
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qdm2: decode directly to the user-provided AVFrame
parent
1b9b6d6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
qdm2.c
libavcodec/qdm2.c
+5
-10
No files found.
libavcodec/qdm2.c
View file @
e01e1a46
...
@@ -130,8 +130,6 @@ typedef struct {
...
@@ -130,8 +130,6 @@ typedef struct {
* QDM2 decoder context
* QDM2 decoder context
*/
*/
typedef
struct
{
typedef
struct
{
AVFrame
frame
;
/// Parameters from codec header, do not change during playback
/// Parameters from codec header, do not change during playback
int
nb_channels
;
///< number of channels
int
nb_channels
;
///< number of channels
int
channels
;
///< number of channels
int
channels
;
///< number of channels
...
@@ -1841,9 +1839,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
...
@@ -1841,9 +1839,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
return
0
;
}
}
...
@@ -1921,6 +1916,7 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
...
@@ -1921,6 +1916,7 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
static
int
qdm2_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
qdm2_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
;
QDM2Context
*
s
=
avctx
->
priv_data
;
QDM2Context
*
s
=
avctx
->
priv_data
;
...
@@ -1933,12 +1929,12 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1933,12 +1929,12 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
return
-
1
;
return
-
1
;
/* get output buffer */
/* get output buffer */
s
->
frame
.
nb_samples
=
16
*
s
->
frame_size
;
frame
->
nb_samples
=
16
*
s
->
frame_size
;
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
;
}
}
out
=
(
int16_t
*
)
s
->
frame
.
data
[
0
];
out
=
(
int16_t
*
)
frame
->
data
[
0
];
for
(
i
=
0
;
i
<
16
;
i
++
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
{
if
(
qdm2_decode
(
s
,
buf
,
out
)
<
0
)
if
(
qdm2_decode
(
s
,
buf
,
out
)
<
0
)
...
@@ -1946,8 +1942,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1946,8 +1942,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
out
+=
s
->
channels
*
s
->
frame_size
;
out
+=
s
->
channels
*
s
->
frame_size
;
}
}
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
return
s
->
checksum_size
;
return
s
->
checksum_size
;
}
}
...
...
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