mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
- audiodec: unify cover handling
(cherry picked from commit ae0f735d998b8cbc5caf969f342be7af747b05f5) Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -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;
|
||||
@@ -521,7 +523,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;
|
||||
|
@@ -1388,9 +1388,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)
|
||||
|
@@ -47,6 +47,8 @@
|
||||
#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf"
|
||||
#define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked"
|
||||
|
||||
#define COVERDIR "/tmp/cover"
|
||||
|
||||
#define LOGODIR ICONSDIR "/logo"
|
||||
#define LOGODIR_VAR ICONSDIR_VAR "/logo"
|
||||
|
||||
|
Reference in New Issue
Block a user