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
c46239af
Commit
c46239af
authored
Feb 04, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.16.x'
Conflicts: src/decoder/ffmpeg_decoder_plugin.c test/read_tags.c test/run_decoder.c
parents
ef5cf40f
48eb3ff8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
35 deletions
+43
-35
NEWS
NEWS
+2
-1
ffmpeg_decoder_plugin.c
src/decoder/ffmpeg_decoder_plugin.c
+36
-34
run_decoder.c
test/run_decoder.c
+5
-0
No files found.
NEWS
View file @
c46239af
...
...
@@ -36,7 +36,8 @@ ver 0.16.7 (2011/??/??)
* input:
- ffmpeg: support libavformat 0.7
* decoder:
- ffmpeg: support libavformat 0.8, libavcodec 0.8
- ffmpeg: support libavformat 0.8, libavcodec 0.9
- ffmpeg: support all MPD tags
* output:
- httpd: fix excessive buffering
- openal: force 16 bit playback, as 8 bit doesn't work
...
...
src/decoder/ffmpeg_decoder_plugin.c
View file @
c46239af
...
...
@@ -359,10 +359,18 @@ static enum sample_format
ffmpeg_sample_format
(
G_GNUC_UNUSED
const
AVCodecContext
*
codec_context
)
{
switch
(
codec_context
->
sample_fmt
)
{
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
case
AV_SAMPLE_FMT_S16
:
#else
case
SAMPLE_FMT_S16
:
#endif
return
SAMPLE_FORMAT_S16
;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 94, 1)
case
AV_SAMPLE_FMT_S32
:
#else
case
SAMPLE_FMT_S32
:
#endif
return
SAMPLE_FORMAT_S32
;
default:
...
...
@@ -571,48 +579,44 @@ typedef struct ffmpeg_tag_map {
}
ffmpeg_tag_map
;
static
const
ffmpeg_tag_map
ffmpeg_tag_maps
[]
=
{
{
TAG_TITLE
,
"title"
},
#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(50<<8))
{
TAG_ARTIST
,
"artist"
},
{
TAG_DATE
,
"date"
},
#else
#if LIBAVFORMAT_VERSION_INT < ((52<<16)+(50<<8))
{
TAG_ARTIST
,
"author"
},
{
TAG_DATE
,
"year"
},
#endif
{
TAG_ALBUM
,
"album"
},
{
TAG_COMMENT
,
"comment"
},
{
TAG_GENRE
,
"genre"
},
{
TAG_TRACK
,
"track"
},
{
TAG_ARTIST_SORT
,
"author-sort"
},
{
TAG_ALBUM_ARTIST
,
"album_artist"
},
{
TAG_ALBUM_ARTIST_SORT
,
"album_artist-sort"
},
{
TAG_COMPOSER
,
"composer"
},
{
TAG_PERFORMER
,
"performer"
},
{
TAG_
DISC
,
"disc"
},
/* sentinel */
{
TAG_
NUM_OF_ITEM_TYPES
,
NULL
}
};
static
bool
ffmpeg_copy_metadata
(
struct
tag
*
tag
,
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,1,0)
AVDictionary
*
m
,
#else
AVMetadata
*
m
,
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53,1,0)
#define AVDictionary AVMetadata
#define AVDictionaryEntry AVMetadataTag
#define av_dict_get av_metadata_get
#endif
const
ffmpeg_tag_map
tag_map
)
static
void
ffmpeg_copy_metadata
(
struct
tag
*
tag
,
enum
tag_type
type
,
AVDictionary
*
m
,
const
char
*
name
)
{
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,5,0)
AVDictionaryEntry
*
mt
=
NULL
;
while
((
mt
=
av_dict_get
(
m
,
tag_map
.
name
,
mt
,
0
))
!=
NULL
)
tag_add_item
(
tag
,
tag_map
.
type
,
mt
->
value
);
#else
AVMetadataTag
*
mt
=
NULL
;
while
((
mt
=
av_dict_get
(
m
,
name
,
mt
,
0
))
!=
NULL
)
tag_add_item
(
tag
,
type
,
mt
->
value
);
}
while
((
mt
=
av_metadata_get
(
m
,
tag_map
.
name
,
mt
,
0
))
!=
NULL
)
tag_add_item
(
tag
,
tag_map
.
type
,
mt
->
value
);
#endif
static
void
ffmpeg_copy_dictionary
(
struct
tag
*
tag
,
AVDictionary
*
dict
)
{
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
ffmpeg_copy_metadata
(
tag
,
i
,
dict
,
tag_item_names
[
i
]);
return
mt
!=
NULL
;
for
(
const
struct
ffmpeg_tag_map
*
i
=
ffmpeg_tag_maps
;
i
->
name
!=
NULL
;
++
i
)
ffmpeg_copy_metadata
(
tag
,
i
->
type
,
dict
,
i
->
name
);
}
//no tag reading in ffmpeg, check if playable
...
...
@@ -660,12 +664,10 @@ ffmpeg_stream_tag(struct input_stream *is)
av_metadata_conv
(
f
,
NULL
,
f
->
iformat
->
metadata_conv
);
#endif
for
(
unsigned
i
=
0
;
i
<
sizeof
(
ffmpeg_tag_maps
)
/
sizeof
(
ffmpeg_tag_map
);
i
++
)
{
int
idx
=
ffmpeg_find_audio_stream
(
f
);
ffmpeg_copy_metadata
(
tag
,
f
->
metadata
,
ffmpeg_tag_maps
[
i
]);
if
(
idx
>=
0
)
ffmpeg_copy_metadata
(
tag
,
f
->
streams
[
idx
]
->
metadata
,
ffmpeg_tag_maps
[
i
]);
}
ffmpeg_copy_dictionary
(
tag
,
f
->
metadata
);
int
idx
=
ffmpeg_find_audio_stream
(
f
);
if
(
idx
>=
0
)
ffmpeg_copy_dictionary
(
tag
,
f
->
streams
[
idx
]
->
metadata
);
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,17,0)
avformat_close_input
(
&
f
);
...
...
test/run_decoder.c
View file @
c46239af
...
...
@@ -21,6 +21,7 @@
#include "io_thread.h"
#include "decoder_list.h"
#include "decoder_api.h"
#include "tag_pool.h"
#include "input_init.h"
#include "input_stream.h"
#include "audio_format.h"
...
...
@@ -190,6 +191,8 @@ int main(int argc, char **argv)
return
EXIT_FAILURE
;
}
tag_pool_init
();
if
(
!
input_stream_global_init
(
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
...
...
@@ -245,5 +248,7 @@ int main(int argc, char **argv)
return
1
;
}
tag_pool_deinit
();
return
0
;
}
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