Merge branch 'master' into pu/mp

This commit is contained in:
M. Liebmann
2017-06-29 15:06:39 +02:00
10 changed files with 103 additions and 65 deletions

View File

@@ -33,15 +33,19 @@
#include <cstring>
#include <errno.h>
#include <sstream>
#include <global.h>
#include <driver/audioplay.h>
#include <zapit/include/audio.h>
#include <eitd/edvbstring.h> // UTF8
#include "ffmpegdec.h"
extern "C" {
#include <libavutil/opt.h>
#include <libavutil/samplefmt.h>
#include <libswresample/swresample.h>
}
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_unref avcodec_get_frame_defaults
@@ -63,8 +67,6 @@ extern cAudio * audioDecoder;
#define ProgName "FfmpegDec"
#define COVERDIR "/tmp/cover"
static OpenThreads::Mutex mutex;
static int cover_count = 0;
@@ -517,7 +519,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
if (save_cover && (avc->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC)) {
mkdir(COVERDIR, 0755);
std::string cover(COVERDIR);
cover += "/" + to_string(cover_count++) + ".jpg";
cover += "/cover_" + to_string(cover_count++) + ".jpg";
FILE *f = fopen(cover.c_str(), "wb");
if (f) {
AVPacket *pkt = &avc->streams[i]->attached_pic;

View File

@@ -1389,9 +1389,10 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m)
data = id3_field_getbinarydata(field, &size);
if ( data )
{
mkdir(COVERDIR, 0755);
std::ostringstream cover;
cover.str("");
cover << "/tmp/cover_" << cover_count++ << ".jpg";
cover.str(COVERDIR);
cover << "/cover_" << cover_count++ << ".jpg";
FILE * pFile;
pFile = fopen ( cover.str().c_str() , "wb" );
if (pFile)

View File

@@ -64,6 +64,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src )
hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ),
title( src.title ), album( src.album ), sc_station( src.sc_station ),
date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover),
logo( src.logo ), url( src.url ),
cover_temporary( false ),
changed( src.changed )
{
@@ -97,9 +98,10 @@ void CAudioMetaData::operator=( const CAudioMetaData& src )
genre = src.genre;
track = src.track;
cover = src.cover;
logo = src.logo;
url = src.url;
sc_station = src.sc_station;
changed = src.changed;
changed = src.changed;
cover_temporary = false;
}
@@ -125,6 +127,8 @@ void CAudioMetaData::clear()
if (cover_temporary && !cover.empty())
unlink(cover.c_str());
cover.clear();
logo.clear();
url.clear();
cover_temporary=false;
changed=false;
}

View File

@@ -96,6 +96,8 @@ public:
std::string genre;
std::string track;
std::string cover;
std::string logo;
std::string url;
bool cover_temporary;
bool changed;
};