Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
246db3d5
Commit
246db3d5
authored
Apr 12, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: use avcodec_decode_audio3() if available
avcodec_decode_audio3() has been added in libavformat 52.25.0, and the predecessor avcodec_decode_audio2() has been deprecated.
parent
eaf414cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
NEWS
NEWS
+1
-1
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+22
-1
No files found.
NEWS
View file @
246db3d5
ver 0.16.3 (2011/??/??)
* fix assertion failure in audio format mask parser
* decoder:
- ffmpeg: support l
avc 53
- ffmpeg: support l
ibavcodec 0.7
ver 0.16.2 (2011/03/18)
...
...
src/decoder/ffmpeg_decoder_plugin.c
View file @
246db3d5
...
...
@@ -194,19 +194,35 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
av_rescale_q
(
packet
->
pts
,
*
time_base
,
(
AVRational
){
1
,
1
}));
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0)
AVPacket
packet2
=
*
packet
;
#else
const
uint8_t
*
packet_data
=
packet
->
data
;
int
packet_size
=
packet
->
size
;
#endif
uint8_t
audio_buf
[(
AVCODEC_MAX_AUDIO_FRAME_SIZE
*
3
)
/
2
+
16
];
size_t
buffer_size
=
sizeof
(
audio_buf
);
int16_t
*
aligned_buffer
=
align16
(
audio_buf
,
&
buffer_size
);
enum
decoder_command
cmd
=
DECODE_COMMAND_NONE
;
while
((
packet_size
>
0
)
&&
(
cmd
==
DECODE_COMMAND_NONE
))
{
while
(
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0)
packet2
.
size
>
0
&&
#else
packet_size
>
0
&&
#endif
cmd
==
DECODE_COMMAND_NONE
)
{
int
audio_size
=
buffer_size
;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0)
int
len
=
avcodec_decode_audio3
(
codec_context
,
aligned_buffer
,
&
audio_size
,
&
packet2
);
#else
int
len
=
avcodec_decode_audio2
(
codec_context
,
aligned_buffer
,
&
audio_size
,
packet_data
,
packet_size
);
#endif
if
(
len
<
0
)
{
/* if error, we skip the frame */
...
...
@@ -214,8 +230,13 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
break
;
}
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0)
packet2
.
data
+=
len
;
packet2
.
size
-=
len
;
#else
packet_data
+=
len
;
packet_size
-=
len
;
#endif
if
(
audio_size
<=
0
)
continue
;
...
...
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