You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-libs/FusionSound/files/FusionSound-1.1.1-ffmpeg-0....

127 lines
5.4 KiB

Parts of:
http://cvs.pld-linux.org/cgi-bin/viewvc.cgi/cvs/packages/FusionSound/FusionSound-ffmpeg.patch?view=markup
and remove a write only variable.
https://bugs.gentoo.org/show_bug.cgi?id=405721
Index: FusionSound-1.1.1/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c
===================================================================
--- FusionSound-1.1.1.orig/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c
+++ FusionSound-1.1.1/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c
@@ -41,6 +41,7 @@
#include <misc/sound_util.h>
+#define FF_API_OLD_METADATA2 0
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -476,17 +477,26 @@ static DFBResult
IFusionSoundMusicProvider_FFmpeg_GetTrackDescription( IFusionSoundMusicProvider *thiz,
FSTrackDescription *desc )
{
+ AVDictionaryEntry *tag = NULL;
+
DIRECT_INTERFACE_GET_DATA( IFusionSoundMusicProvider_FFmpeg )
if (!desc)
return DFB_INVARG;
- direct_snputs( desc->artist, data->ctx->author, FS_TRACK_DESC_ARTIST_LENGTH );
- direct_snputs( desc->title, data->ctx->title, FS_TRACK_DESC_TITLE_LENGTH );
- direct_snputs( desc->album, data->ctx->album, FS_TRACK_DESC_ALBUM_LENGTH );
- direct_snputs( desc->genre, data->ctx->genre, FS_TRACK_DESC_GENRE_LENGTH );
- direct_snputs( desc->encoding, data->codec->codec->name, FS_TRACK_DESC_ENCODING_LENGTH );
- desc->year = data->ctx->year;
+ tag = av_dict_get(data->ctx->metadata, "artist", NULL, 0);
+ if (tag) direct_snputs( desc->artist, tag->value, FS_TRACK_DESC_ARTIST_LENGTH );
+ tag = av_dict_get(data->ctx->metadata, "title", NULL, 0);
+ if (tag) direct_snputs( desc->title, tag->value, FS_TRACK_DESC_TITLE_LENGTH );
+ tag = av_dict_get(data->ctx->metadata, "album", NULL, 0);
+ if (tag) direct_snputs( desc->album, tag->value, FS_TRACK_DESC_ALBUM_LENGTH );
+ tag = av_dict_get(data->ctx->metadata, "genre", NULL, 0);
+ if (tag) direct_snputs( desc->genre, tag->value, FS_TRACK_DESC_GENRE_LENGTH );
+ tag = av_dict_get(data->ctx->metadata, "encoding", NULL, 0);
+ if (tag) direct_snputs( desc->encoding, tag->value, FS_TRACK_DESC_ENCODING_LENGTH );
+ tag = av_dict_get(data->ctx->metadata, "year", NULL, 0);
+ if (tag) desc->year = atoi(tag->value);
+
desc->bitrate = data->codec->bit_rate;
desc->replaygain = desc->replaygain_album = 0;
@@ -540,7 +550,6 @@ FFmpegStreamThread( DirectThread *thread
IFusionSoundMusicProvider_FFmpeg_data *data = ctx;
AVPacket pkt;
- u8 *pkt_data = NULL;
int pkt_size = 0;
s64 pkt_pts = AV_NOPTS_VALUE;
@@ -584,7 +593,6 @@ FFmpegStreamThread( DirectThread *thread
continue;
}
- pkt_data = pkt.data;
pkt_size = pkt.size;
pkt_pts = pkt.pts;
if (pkt_pts != AV_NOPTS_VALUE) {
@@ -595,14 +603,13 @@ FFmpegStreamThread( DirectThread *thread
}
len = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- decoded = avcodec_decode_audio2( data->codec,
- (s16*)data->buf, &len, pkt_data, pkt_size );
+ decoded = avcodec_decode_audio3( data->codec,
+ (s16*)data->buf, &len, &pkt );
if (decoded < 0) {
av_free_packet( &pkt );
pkt_size = 0;
}
else {
- pkt_data += decoded;
pkt_size -= decoded;
if (pkt_size <= 0)
av_free_packet( &pkt );
@@ -739,7 +746,6 @@ FFmpegBufferThread( DirectThread *thread
IFusionSoundMusicProvider_FFmpeg_data *data = ctx;
AVPacket pkt;
- u8 *pkt_data = NULL;
int pkt_size = 0;
s64 pkt_pts = AV_NOPTS_VALUE;
int pos = 0;
@@ -789,7 +795,6 @@ FFmpegBufferThread( DirectThread *thread
continue;
}
- pkt_data = pkt.data;
pkt_size = pkt.size;
pkt_pts = pkt.pts;
if (pkt_pts != AV_NOPTS_VALUE) {
@@ -800,14 +805,13 @@ FFmpegBufferThread( DirectThread *thread
}
len = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- decoded = avcodec_decode_audio2( data->codec,
- (s16*)data->buf, &len, pkt_data, pkt_size );
+ decoded = avcodec_decode_audio3( data->codec,
+ (s16*)data->buf, &len, &pkt );
if (decoded < 0) {
av_free_packet( &pkt );
pkt_size = 0;
}
else {
- pkt_data += decoded;
pkt_size -= decoded;
if (pkt_size <= 0)
av_free_packet( &pkt );
@@ -1208,7 +1212,7 @@ Construct( IFusionSoundMusicProvider *th
}
for (i = 0; i < data->ctx->nb_streams; i++) {
- if (data->ctx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
+ if (data->ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if (!data->st || data->st->codec->bit_rate < data->ctx->streams[i]->codec->bit_rate)
data->st = data->ctx->streams[i];
}