2008-02-26 20:53:18 +00:00
|
|
|
//
|
2013-10-07 17:33:35 +00:00
|
|
|
// FFMPEGDecoder.h
|
|
|
|
// FFMPEG
|
2008-02-26 20:53:18 +00:00
|
|
|
//
|
|
|
|
// Created by Andre Reffhaug on 2/26/08.
|
|
|
|
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
2022-02-07 05:49:27 +00:00
|
|
|
|
2008-02-26 20:53:18 +00:00
|
|
|
#import "Plugin.h"
|
|
|
|
|
2016-05-07 06:35:04 +00:00
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavformat/avformat.h>
|
2008-02-26 20:53:18 +00:00
|
|
|
|
2022-06-25 08:35:07 +00:00
|
|
|
extern int ffmpeg_read(void *opaque, uint8_t *buf, int buf_size);
|
|
|
|
extern int ffmpeg_write(void *opaque, uint8_t *buf, int buf_size);
|
|
|
|
int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence);
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
@interface FFMPEGDecoder : NSObject <CogDecoder> {
|
|
|
|
id<CogSource> source;
|
|
|
|
BOOL seekable;
|
|
|
|
int channels;
|
2022-02-07 10:06:51 +00:00
|
|
|
uint32_t channelConfig;
|
2022-02-07 05:49:27 +00:00
|
|
|
int bitsPerSample;
|
|
|
|
BOOL floatingPoint;
|
|
|
|
BOOL lossy;
|
|
|
|
float frequency;
|
|
|
|
long totalFrames;
|
|
|
|
long framesRead;
|
|
|
|
int bitrate;
|
2022-06-25 08:35:07 +00:00
|
|
|
int subsong;
|
|
|
|
int64_t startTime;
|
|
|
|
int64_t endTime;
|
2022-06-25 09:36:14 +00:00
|
|
|
BOOL seekedToStart;
|
2022-02-07 05:49:27 +00:00
|
|
|
|
|
|
|
@private
|
|
|
|
unsigned char *buffer;
|
|
|
|
AVIOContext *ioCtx;
|
|
|
|
int streamIndex;
|
|
|
|
AVFormatContext *formatCtx;
|
|
|
|
AVCodecContext *codecCtx;
|
|
|
|
AVFrame *lastDecodedFrame;
|
|
|
|
AVPacket *lastReadPacket;
|
2022-02-10 08:32:24 +00:00
|
|
|
|
2022-07-21 11:03:21 +00:00
|
|
|
int sampleBufferSize;
|
|
|
|
uint8_t *sampleBuffer;
|
|
|
|
|
2022-07-21 10:50:39 +00:00
|
|
|
int metadataUpdateInterval;
|
|
|
|
int metadataUpdateCount;
|
|
|
|
|
2022-06-11 13:39:00 +00:00
|
|
|
BOOL metadataUpdated;
|
|
|
|
|
2022-07-10 22:14:47 +00:00
|
|
|
AudioChunk *prebufferedChunk;
|
2022-06-11 13:39:00 +00:00
|
|
|
|
2022-02-10 08:32:24 +00:00
|
|
|
BOOL rawDSD;
|
|
|
|
BOOL rawDSDReverseBits;
|
|
|
|
BOOL rawDSDPlanar;
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
int bytesConsumedFromDecodedFrame;
|
|
|
|
BOOL readNextPacket;
|
|
|
|
int64_t seekFrame;
|
|
|
|
int64_t skipSamples;
|
|
|
|
BOOL endOfStream;
|
|
|
|
BOOL endOfAudio;
|
2022-02-09 05:33:56 +00:00
|
|
|
|
|
|
|
int metadataIndex;
|
2022-02-10 23:29:13 +00:00
|
|
|
|
|
|
|
int attachedPicIndex;
|
2022-07-08 13:26:28 +00:00
|
|
|
|
2022-02-10 23:29:13 +00:00
|
|
|
NSData *albumArt;
|
|
|
|
|
2022-07-08 13:26:28 +00:00
|
|
|
NSDictionary *metaDict;
|
|
|
|
|
2022-02-09 05:33:56 +00:00
|
|
|
NSDictionary *id3Metadata;
|
2008-02-26 20:53:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|