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
cbdaa136
Commit
cbdaa136
authored
Oct 05, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.17.x'
Conflicts: src/PlaylistSave.cxx
parents
b8fdb452
8fb20fcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
14 deletions
+65
-14
NEWS
NEWS
+3
-0
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+53
-12
playlist_song.c
src/playlist_song.c
+9
-2
No files found.
NEWS
View file @
cbdaa136
...
@@ -18,6 +18,9 @@ ver 0.17.3 (2012/??/??)
...
@@ -18,6 +18,9 @@ ver 0.17.3 (2012/??/??)
- recorder: fix I/O error check
- recorder: fix I/O error check
- shout: fix memory leak in error handler
- shout: fix memory leak in error handler
- recorder, shout: support Ogg packets that span more than one page
- recorder, shout: support Ogg packets that span more than one page
* decoder:
- ffmpeg: ignore negative time stamps
- ffmpeg: support planar audio
ver 0.17.2 (2012/09/30)
ver 0.17.2 (2012/09/30)
* protocol:
* protocol:
...
...
src/decoder/ffmpeg_decoder_plugin.c
View file @
cbdaa136
...
@@ -234,6 +234,21 @@ time_to_ffmpeg(double t, const AVRational time_base)
...
@@ -234,6 +234,21 @@ time_to_ffmpeg(double t, const AVRational time_base)
}
}
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,25,0)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,25,0)
static
void
copy_interleave_frame2
(
uint8_t
*
dest
,
uint8_t
**
src
,
unsigned
nframes
,
unsigned
nchannels
,
unsigned
sample_size
)
{
for
(
unsigned
frame
=
0
;
frame
<
nframes
;
++
frame
)
{
for
(
unsigned
channel
=
0
;
channel
<
nchannels
;
++
channel
)
{
memcpy
(
dest
,
src
[
channel
]
+
frame
*
sample_size
,
sample_size
);
dest
+=
sample_size
;
}
}
}
/**
/**
* Copy PCM data from a AVFrame to an interleaved buffer.
* Copy PCM data from a AVFrame to an interleaved buffer.
*/
*/
...
@@ -254,11 +269,10 @@ copy_interleave_frame(const AVCodecContext *codec_context,
...
@@ -254,11 +269,10 @@ copy_interleave_frame(const AVCodecContext *codec_context,
if
(
av_sample_fmt_is_planar
(
codec_context
->
sample_fmt
)
&&
if
(
av_sample_fmt_is_planar
(
codec_context
->
sample_fmt
)
&&
codec_context
->
channels
>
1
)
{
codec_context
->
channels
>
1
)
{
for
(
int
i
=
0
,
channels
=
codec_context
->
channels
;
copy_interleave_frame2
(
buffer
,
frame
->
extended_data
,
i
<
channels
;
i
++
)
{
frame
->
nb_samples
,
memcpy
(
buffer
,
frame
->
extended_data
[
i
],
plane_size
);
codec_context
->
channels
,
buffer
+=
plane_size
;
av_get_bytes_per_sample
(
codec_context
->
sample_fmt
));
}
}
else
{
}
else
{
memcpy
(
buffer
,
frame
->
extended_data
[
0
],
data_size
);
memcpy
(
buffer
,
frame
->
extended_data
[
0
],
data_size
);
}
}
...
@@ -273,7 +287,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
...
@@ -273,7 +287,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
AVCodecContext
*
codec_context
,
AVCodecContext
*
codec_context
,
const
AVRational
*
time_base
)
const
AVRational
*
time_base
)
{
{
if
(
packet
->
pts
!=
(
int64_t
)
AV_NOPTS_VALUE
)
if
(
packet
->
pts
>=
0
&&
packet
->
pts
!=
(
int64_t
)
AV_NOPTS_VALUE
)
decoder_timestamp
(
decoder
,
decoder_timestamp
(
decoder
,
time_from_ffmpeg
(
packet
->
pts
,
*
time_base
));
time_from_ffmpeg
(
packet
->
pts
,
*
time_base
));
...
@@ -352,12 +366,20 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
...
@@ -352,12 +366,20 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
return
cmd
;
return
cmd
;
}
}
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 94, 1)
#define AVSampleFormat SampleFormat
#endif
G_GNUC_CONST
static
enum
sample_format
static
enum
sample_format
ffmpeg_sample_format
(
G_GNUC_UNUSED
const
AVCodecContext
*
codec_contex
t
)
ffmpeg_sample_format
(
enum
AVSampleFormat
sample_fm
t
)
{
{
switch
(
codec_context
->
sample_fmt
)
{
switch
(
sample_fmt
)
{
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
case
AV_SAMPLE_FMT_S16
:
case
AV_SAMPLE_FMT_S16
:
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,17,0)
case
AV_SAMPLE_FMT_S16P
:
#endif
#else
#else
case
SAMPLE_FMT_S16
:
case
SAMPLE_FMT_S16
:
#endif
#endif
...
@@ -365,16 +387,30 @@ ffmpeg_sample_format(G_GNUC_UNUSED const AVCodecContext *codec_context)
...
@@ -365,16 +387,30 @@ ffmpeg_sample_format(G_GNUC_UNUSED const AVCodecContext *codec_context)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
case
AV_SAMPLE_FMT_S32
:
case
AV_SAMPLE_FMT_S32
:
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,17,0)
case
AV_SAMPLE_FMT_S32P
:
#endif
#else
#else
case
SAMPLE_FMT_S32
:
case
SAMPLE_FMT_S32
:
#endif
#endif
return
SAMPLE_FORMAT_S32
;
return
SAMPLE_FORMAT_S32
;
default:
default:
g_warning
(
"Unsupported libavcodec SampleFormat value: %d"
,
break
;
codec_context
->
sample_fmt
);
return
SAMPLE_FORMAT_UNDEFINED
;
}
}
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
char
buffer
[
64
];
const
char
*
name
=
av_get_sample_fmt_string
(
buffer
,
sizeof
(
buffer
),
sample_fmt
);
if
(
name
!=
NULL
)
g_warning
(
"Unsupported libavcodec SampleFormat value: %s (%d)"
,
name
,
sample_fmt
);
else
#endif
g_warning
(
"Unsupported libavcodec SampleFormat value: %d"
,
sample_fmt
);
return
SAMPLE_FORMAT_UNDEFINED
;
}
}
static
AVInputFormat
*
static
AVInputFormat
*
...
@@ -485,11 +521,16 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
...
@@ -485,11 +521,16 @@ ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
return
;
return
;
}
}
const
enum
sample_format
sample_format
=
ffmpeg_sample_format
(
codec_context
->
sample_fmt
);
if
(
sample_format
==
SAMPLE_FORMAT_UNDEFINED
)
return
;
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
if
(
!
audio_format_init_checked
(
&
audio_format
,
if
(
!
audio_format_init_checked
(
&
audio_format
,
codec_context
->
sample_rate
,
codec_context
->
sample_rate
,
ffmpeg_sample_format
(
codec_context
)
,
sample_format
,
codec_context
->
channels
,
&
error
))
{
codec_context
->
channels
,
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
g_error_free
(
error
);
...
...
src/playlist_song.c
View file @
cbdaa136
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "mapper.h"
#include "mapper.h"
#include "song.h"
#include "song.h"
#include "uri.h"
#include "uri.h"
#include "path.h"
#include "ls.h"
#include "ls.h"
#include "tag.h"
#include "tag.h"
...
@@ -62,8 +63,14 @@ apply_song_metadata(struct song *dest, const struct song *src)
...
@@ -62,8 +63,14 @@ apply_song_metadata(struct song *dest, const struct song *src)
if
(
path_fs
==
NULL
)
if
(
path_fs
==
NULL
)
return
dest
;
return
dest
;
tmp
=
song_file_new
(
path_fs
,
NULL
);
char
*
path_utf8
=
fs_charset_to_utf8
(
path_fs
);
g_free
(
path_fs
);
if
(
path_utf8
!=
NULL
)
g_free
(
path_fs
);
else
path_utf8
=
path_fs
;
tmp
=
song_file_new
(
path_utf8
,
NULL
);
g_free
(
path_utf8
);
merge_song_metadata
(
tmp
,
dest
,
src
);
merge_song_metadata
(
tmp
,
dest
,
src
);
}
else
{
}
else
{
...
...
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