libeplayer3: run through indent, no binary change

This commit is contained in:
martii
2013-11-21 19:40:47 +01:00
parent 2c2ca45360
commit 2d652aab01
48 changed files with 6645 additions and 5857 deletions

View File

@@ -22,36 +22,36 @@
#define AAC_HEADER_LENGTH 7
static inline int aac_get_sample_rate_index (uint32_t sample_rate)
static inline int aac_get_sample_rate_index(uint32_t sample_rate)
{
if (96000 <= sample_rate)
return 0;
return 0;
else if (88200 <= sample_rate)
return 1;
return 1;
else if (64000 <= sample_rate)
return 2;
return 2;
else if (48000 <= sample_rate)
return 3;
return 3;
else if (44100 <= sample_rate)
return 4;
return 4;
else if (32000 <= sample_rate)
return 5;
return 5;
else if (24000 <= sample_rate)
return 6;
return 6;
else if (22050 <= sample_rate)
return 7;
return 7;
else if (16000 <= sample_rate)
return 8;
return 8;
else if (12000 <= sample_rate)
return 9;
return 9;
else if (11025 <= sample_rate)
return 10;
return 10;
else if (8000 <= sample_rate)
return 11;
return 11;
else if (7350 <= sample_rate)
return 12;
return 12;
else
return 13;
return 13;
}
#endif

View File

@@ -8,11 +8,12 @@
#include <pthread.h>
typedef struct Context_s {
PlaybackHandler_t * playback;
ContainerHandler_t * container;
OutputHandler_t * output;
ManagerHandler_t * manager;
PlaybackHandler_t *playback;
ContainerHandler_t *container;
OutputHandler_t *output;
ManagerHandler_t *manager;
} Context_t;
int container_ffmpeg_update_tracks(Context_t *context, char *filename, int initial);
int container_ffmpeg_update_tracks(Context_t * context, char *filename,
int initial);
#endif

View File

@@ -3,30 +3,30 @@
#include <stdio.h>
typedef enum {
CONTAINER_INIT,
CONTAINER_ADD,
CONTAINER_CAPABILITIES,
CONTAINER_PLAY,
CONTAINER_STOP,
CONTAINER_SEEK,
CONTAINER_SEEK_ABS,
CONTAINER_LENGTH,
CONTAINER_DEL,
CONTAINER_SWITCH_AUDIO,
CONTAINER_SWITCH_SUBTITLE,
CONTAINER_SWITCH_DVBSUBTITLE,
CONTAINER_SWITCH_TELETEXT,
CONTAINER_INFO,
CONTAINER_STATUS,
CONTAINER_LAST_PTS,
CONTAINER_DATA
typedef enum {
CONTAINER_INIT,
CONTAINER_ADD,
CONTAINER_CAPABILITIES,
CONTAINER_PLAY,
CONTAINER_STOP,
CONTAINER_SEEK,
CONTAINER_SEEK_ABS,
CONTAINER_LENGTH,
CONTAINER_DEL,
CONTAINER_SWITCH_AUDIO,
CONTAINER_SWITCH_SUBTITLE,
CONTAINER_SWITCH_DVBSUBTITLE,
CONTAINER_SWITCH_TELETEXT,
CONTAINER_INFO,
CONTAINER_STATUS,
CONTAINER_LAST_PTS,
CONTAINER_DATA
} ContainerCmd_t;
typedef struct Container_s {
char * Name;
int (* Command) (/*Context_t*/void *, ContainerCmd_t, void *);
char ** Capabilities;
char *Name;
int (*Command) ( /*Context_t */ void *, ContainerCmd_t, void *);
char **Capabilities;
} Container_t;
@@ -34,13 +34,13 @@ typedef struct Container_s {
extern Container_t FFMPEGContainer;
typedef struct ContainerHandler_s {
char * Name;
Container_t * selectedContainer;
Container_t * textSrtContainer;
Container_t * textSsaContainer;
Container_t * assContainer;
char *Name;
Container_t *selectedContainer;
Container_t *textSrtContainer;
Container_t *textSsaContainer;
Container_t *assContainer;
int (* Command) (/*Context_t*/void *, ContainerCmd_t, void *);
int (*Command) ( /*Context_t */ void *, ContainerCmd_t, void *);
} ContainerHandler_t;
#endif

View File

@@ -8,11 +8,10 @@ static inline void Hexdump(unsigned char *Data, int length)
{
int k;
for (k = 0; k < length; k++)
{
printf("%02x ", Data[k]);
if (((k+1)&31)==0)
printf("\n");
for (k = 0; k < length; k++) {
printf("%02x ", Data[k]);
if (((k + 1) & 31) == 0)
printf("\n");
}
printf("\n");

View File

@@ -11,35 +11,34 @@
/* metatdata map list:
*/
char* metadata_map[] =
{
/* our tags ffmpeg tag / id3v2 */
"Title", "TIT2",
"Title", "TT2",
"Artist", "TPE1",
"Artist", "TP1",
"AlbumArtist", "TPE2",
"AlbumArtist", "TP2",
"Album", "TALB",
"Album", "TAL",
"Year", "TDRL", /* fixme */
"Year", "TDRC", /* fixme */
"Comment", "unknown",
"Track", "TRCK",
"Track", "TRK",
"Copyright", "TCOP",
"Composer", "TCOM",
"Genre", "TCON",
"Genre", "TCO",
"EncodedBy", "TENC",
"EncodedBy", "TEN",
"Language", "TLAN",
"Performer", "TPE3",
"Performer", "TP3",
"Publisher", "TPUB",
"Encoder", "TSSE",
"Disc", "TPOS",
NULL
char *metadata_map[] = {
/* our tags ffmpeg tag / id3v2 */
"Title", "TIT2",
"Title", "TT2",
"Artist", "TPE1",
"Artist", "TP1",
"AlbumArtist", "TPE2",
"AlbumArtist", "TP2",
"Album", "TALB",
"Album", "TAL",
"Year", "TDRL", /* fixme */
"Year", "TDRC", /* fixme */
"Comment", "unknown",
"Track", "TRCK",
"Track", "TRK",
"Copyright", "TCOP",
"Composer", "TCOM",
"Genre", "TCON",
"Genre", "TCO",
"EncodedBy", "TENC",
"EncodedBy", "TEN",
"Language", "TLAN",
"Performer", "TPE3",
"Performer", "TP3",
"Publisher", "TPUB",
"Encoder", "TSSE",
"Disc", "TPOS",
NULL
};
#endif

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdint.h>
typedef enum {
MANAGER_ADD,
MANAGER_LIST,
@@ -22,62 +22,62 @@ typedef enum {
} eTrackTypeEplayer;
typedef struct Track_s {
char * Name;
char * Encoding;
int Id;
char *Name;
char *Encoding;
int Id;
/* new field for ffmpeg - add at the end so no problem
* can occur with not changed srt saa container
*/
char* language;
* can occur with not changed srt saa container
*/
char *language;
/* length of track */
long long int duration;
unsigned int frame_rate;
unsigned int TimeScale;
int version;
long long int pts;
long long int duration;
unsigned int frame_rate;
unsigned int TimeScale;
int version;
long long int pts;
/* for later use: */
eTrackTypeEplayer type;
int width;
int height;
eTrackTypeEplayer type;
int width;
int height;
/* stream from ffmpeg */
void * stream;
void *stream;
/* codec extra data (header or some other stuff) */
void * extraData;
int extraSize;
void *extraData;
int extraSize;
uint8_t* aacbuf;
unsigned int aacbuflen;
int have_aacheader;
uint8_t *aacbuf;
unsigned int aacbuflen;
int have_aacheader;
/* If player2 or the elf do not support decoding of audio codec set this.
* AVCodec is than used for softdecoding and stream will be injected as PCM */
int inject_as_pcm;
int inject_raw_pcm;
int inject_as_pcm;
int inject_raw_pcm;
int pending;
int pending;
} Track_t;
typedef struct Manager_s {
char * Name;
int (* Command) (/*Context_t*/void *, ManagerCmd_t, void *);
char ** Capabilities;
char *Name;
int (*Command) ( /*Context_t */ void *, ManagerCmd_t, void *);
char **Capabilities;
} Manager_t;
typedef struct ManagerHandler_s {
char * Name;
Manager_t * audio;
Manager_t * video;
Manager_t * subtitle;
Manager_t * dvbsubtitle;
Manager_t * teletext;
char *Name;
Manager_t *audio;
Manager_t *video;
Manager_t *subtitle;
Manager_t *dvbsubtitle;
Manager_t *teletext;
} ManagerHandler_t;
void freeTrack(Track_t* track);
void copyTrack(Track_t* to, Track_t* from);
void freeTrack(Track_t * track);
void copyTrack(Track_t * to, Track_t * from);
#endif

View File

@@ -9,11 +9,10 @@
/* Types */
/* ***************************** */
typedef struct BitPacker_s
{
unsigned char* Ptr; /* write pointer */
unsigned int BitBuffer; /* bitreader shifter */
int Remaining; /* number of remaining in the shifter */
typedef struct BitPacker_s {
unsigned char *Ptr; /* write pointer */
unsigned int BitBuffer; /* bitreader shifter */
int Remaining; /* number of remaining in the shifter */
} BitPacker_t;
/* ***************************** */
@@ -37,54 +36,52 @@ void FlushBits(BitPacker_t * ld);
/* MISC Functions */
/* ***************************** */
static inline char *getExtension(char * name)
static inline char *getExtension(char *name)
{
if (name) {
char *ext = strrchr(name, '.');
if (ext)
return ext + 1;
}
return NULL;
if (name) {
char *ext = strrchr(name, '.');
if (ext)
return ext + 1;
}
return NULL;
}
/* the function returns the base name */
static inline char * basename(char * name)
static inline char *basename(char *name)
{
int i = 0;
int pos = 0;
int i = 0;
int pos = 0;
while(name[i] != 0)
{
if(name[i] == '/')
pos = i;
i++;
}
while (name[i] != 0) {
if (name[i] == '/')
pos = i;
i++;
}
if(name[pos] == '/')
pos++;
if (name[pos] == '/')
pos++;
return name + pos;
return name + pos;
}
/* the function returns the directry name */
static inline char * dirname(char * name)
static inline char *dirname(char *name)
{
static char path[100];
unsigned int i = 0;
int pos = 0;
static char path[100];
unsigned int i = 0;
int pos = 0;
while((name[i] != 0) && (i < sizeof(path)))
{
if(name[i] == '/')
pos = i;
path[i] = name[i];
i++;
}
while ((name[i] != 0) && (i < sizeof(path))) {
if (name[i] == '/')
pos = i;
path[i] = name[i];
i++;
}
path[i] = 0;
path[pos] = 0;
path[i] = 0;
path[pos] = 0;
return path;
return path;
}
#endif

View File

@@ -32,30 +32,29 @@ typedef enum {
OUTPUT_SET_SUBTITLE_OUTPUT
} OutputCmd_t;
typedef struct
{
unsigned char* data;
unsigned int len;
typedef struct {
unsigned char *data;
unsigned int len;
unsigned char* extradata;
unsigned int extralen;
unsigned long long int pts;
float frameRate;
unsigned int timeScale;
unsigned int width;
unsigned int height;
char* type;
unsigned char *extradata;
unsigned int extralen;
unsigned long long int pts;
float frameRate;
unsigned int timeScale;
unsigned int width;
unsigned int height;
char *type;
} AudioVideoOut_t;
typedef struct Output_s {
char * Name;
int (* Command) (/*Context_t*/void *, OutputCmd_t, void *);
int (* Write) (/*Context_t*/void *, void* privateData);
char ** Capabilities;
char *Name;
int (*Command) ( /*Context_t */ void *, OutputCmd_t, void *);
int (*Write) ( /*Context_t */ void *, void *privateData);
char **Capabilities;
} Output_t;
@@ -64,13 +63,13 @@ extern Output_t SubtitleOutput;
extern Output_t PipeOutput;
typedef struct OutputHandler_s {
char * Name;
Output_t * audio;
Output_t * video;
Output_t * subtitle;
Output_t * dvbsubtitle;
Output_t * teletext;
int (* Command) (/*Context_t*/void *, OutputCmd_t, void *);
char *Name;
Output_t *audio;
Output_t *video;
Output_t *subtitle;
Output_t *dvbsubtitle;
Output_t *teletext;
int (*Command) ( /*Context_t */ void *, OutputCmd_t, void *);
} OutputHandler_t;
#endif

View File

@@ -20,8 +20,7 @@
#ifndef pcm_h_
#define pcm_h_
typedef struct pcmPrivateData_s
{
typedef struct pcmPrivateData_s {
int uNoOfChannels;
int uSampleRate;
int uBitsPerSample;

View File

@@ -26,7 +26,8 @@
#define VC1_VIDEO_PES_START_CODE 0xfd
#define AAC_AUDIO_PES_START_CODE 0xcf
int InsertPesHeader (unsigned char *data, int size, unsigned char stream_id, unsigned long long int pts, int pic_start_code);
int InsertPesHeader(unsigned char *data, int size, unsigned char stream_id,
unsigned long long int pts, int pic_start_code);
int InsertVideoPrivateDataHeader(unsigned char *data, int payload_size);
#endif

View File

@@ -2,10 +2,18 @@
#define PLAYBACK_H_
#include <sys/types.h>
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT, PLAYBACK_SWITCH_TELETEXT, PLAYBACK_SWITCH_DVBSUBTITLE, PLAYBACK_FRAMEBUFFER_LOCK, PLAYBACK_FRAMEBUFFER_UNLOCK} PlaybackCmd_t;
typedef enum { PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP,
PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM,
PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS,
PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO,
PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION,
PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT,
PLAYBACK_SWITCH_TELETEXT, PLAYBACK_SWITCH_DVBSUBTITLE,
PLAYBACK_FRAMEBUFFER_LOCK,
PLAYBACK_FRAMEBUFFER_UNLOCK } PlaybackCmd_t;
typedef struct PlaybackHandler_s {
char * Name;
char *Name;
int fd;
@@ -31,9 +39,9 @@ typedef struct PlaybackHandler_s {
unsigned char mayWriteToFramebuffer;
unsigned char abortRequested;
int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *);
char * uri;
unsigned char noprobe; /* hack: only minimal probing in av_find_stream_info */
int (*Command) ( /*Context_t */ void *, PlaybackCmd_t, void *);
char *uri;
unsigned char noprobe; /* hack: only minimal probing in av_find_stream_info */
unsigned long long readCount;
} PlaybackHandler_t;

View File

@@ -33,93 +33,95 @@ Style: Default,Arial,64,16777215,0,16777215,0,0,0,2,2,2,2,20,20,10,0\n\n\
[Events]\n\
Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n\n\n"
static inline unsigned char* text_to_ass(char *text, long long int pts, double duration)
static inline unsigned char *text_to_ass(char *text, long long int pts,
double duration)
{
char buf[1024];
unsigned int x,pos=0;
for(x=0;x<strlen(text);x++){
if(text[x]=='\n'){
buf[pos++]='\\';
buf[pos++]='N';
}else if(text[x]!='\r')buf[pos++]=text[x];
}
buf[pos++]='\0';
int len = 80 + strlen(buf);
long long int end_pts = pts + (duration * 1000.0);
char* line = (char*)malloc( sizeof(char) * len );
int sc = pts / 10;
int ec = end_pts / 10;
int sh, sm, ss, eh, em, es;
sh = sc/360000; sc -= 360000*sh;
sm = sc/ 6000; sc -= 6000*sm;
ss = sc/ 100; sc -= 100*ss;
eh = ec/360000; ec -= 360000*eh;
em = ec/ 6000; ec -= 6000*em;
es = ec/ 100; ec -= 100*es;
snprintf(line,len,"Dialogue: Marked=0,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,Default,NTP,0000,0000,0000,!Effect,%s\n",
sh, sm, ss, sc, eh, em, es, ec, buf);
char buf[1024];
unsigned int x, pos = 0;
for (x = 0; x < strlen(text); x++) {
if (text[x] == '\n') {
buf[pos++] = '\\';
buf[pos++] = 'N';
} else if (text[x] != '\r')
buf[pos++] = text[x];
}
buf[pos++] = '\0';
int len = 80 + strlen(buf);
long long int end_pts = pts + (duration * 1000.0);
char *line = (char *) malloc(sizeof(char) * len);
int sc = pts / 10;
int ec = end_pts / 10;
int sh, sm, ss, eh, em, es;
sh = sc / 360000;
sc -= 360000 * sh;
sm = sc / 6000;
sc -= 6000 * sm;
ss = sc / 100;
sc -= 100 * ss;
eh = ec / 360000;
ec -= 360000 * eh;
em = ec / 6000;
ec -= 6000 * em;
es = ec / 100;
ec -= 100 * es;
snprintf(line, len,
"Dialogue: Marked=0,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,Default,NTP,0000,0000,0000,!Effect,%s\n",
sh, sm, ss, sc, eh, em, es, ec, buf);
return (unsigned char*)line;
return (unsigned char *) line;
}
typedef enum
{
typedef enum {
eSub_Gfx,
eSub_Txt
} SubType_t;
typedef struct
{
unsigned char* data;
int len;
typedef struct {
unsigned char *data;
int len;
} SubText_t;
typedef struct
{
unsigned char* data;
unsigned int Width;
unsigned int Height;
unsigned int Stride;
unsigned int x;
unsigned int y;
unsigned int color;
typedef struct {
unsigned char *data;
unsigned int Width;
unsigned int Height;
unsigned int Stride;
unsigned int x;
unsigned int y;
unsigned int color;
} SubGfx_t;
typedef struct
{
SubType_t type;
long long int pts;
float duration;
union
{
SubText_t text;
SubGfx_t gfx;
typedef struct {
SubType_t type;
long long int pts;
float duration;
union {
SubText_t text;
SubGfx_t gfx;
} u;
} SubtitleOut_t;
typedef struct
{
unsigned char* data;
int len;
typedef struct {
unsigned char *data;
int len;
unsigned char* extradata;
int extralen;
long long int pts;
float duration;
unsigned char *extradata;
int extralen;
long long int pts;
float duration;
} SubtitleData_t;
typedef struct
{
uint32_t *destination;
unsigned int screen_width;
unsigned int screen_height;
unsigned int destStride;
void (*framebufferBlit)(void);
typedef struct {
uint32_t *destination;
unsigned int screen_width;
unsigned int screen_height;
unsigned int destStride;
void (*framebufferBlit) (void);
} SubtitleOutputDef_t;
#endif

View File

@@ -4,52 +4,52 @@
#include <stdio.h>
#include <stdint.h>
typedef enum { eNone, eAudio, eVideo, eGfx} eWriterType_t;
typedef enum { eNone, eAudio, eVideo, eGfx } eWriterType_t;
typedef struct {
int fd;
unsigned char* data;
unsigned int len;
int fd;
unsigned char *data;
unsigned int len;
unsigned long long int Pts;
unsigned char* private_data;
unsigned int private_size;
unsigned int FrameRate;
unsigned int FrameScale;
unsigned int Width;
unsigned int Height;
unsigned char Version;
unsigned char *private_data;
unsigned int private_size;
unsigned int FrameRate;
unsigned int FrameScale;
unsigned int Width;
unsigned int Height;
unsigned char Version;
} WriterAVCallData_t;
typedef struct {
unsigned char* data;
unsigned int Width;
unsigned int Height;
unsigned int Stride;
unsigned int color;
unsigned char *data;
unsigned int Width;
unsigned int Height;
unsigned int Stride;
unsigned int color;
unsigned int x; /* dst x ->given by ass */
unsigned int y; /* dst y ->given by ass */
unsigned int x; /* dst x ->given by ass */
unsigned int y; /* dst y ->given by ass */
/* destination values if we use a shared framebuffer */
int fd;
unsigned int Screen_Width;
unsigned int Screen_Height;
uint32_t *destination;
unsigned int destStride;
int fd;
unsigned int Screen_Width;
unsigned int Screen_Height;
uint32_t *destination;
unsigned int destStride;
} WriterFBCallData_t;
typedef struct WriterCaps_s {
char* name;
eWriterType_t type;
char* textEncoding;
char *name;
eWriterType_t type;
char *textEncoding;
/* fixme: revise if this is an enum! */
int dvbEncoding;
int dvbEncoding;
} WriterCaps_t;
typedef struct Writer_s {
int (* reset) ();
int (* writeData) (void*);
int (* writeReverseData) (void*);
int (*reset) ();
int (*writeData) (void *);
int (*writeReverseData) (void *);
WriterCaps_t *caps;
} Writer_t;
@@ -79,10 +79,10 @@ extern Writer_t WriterFramebuffer;
extern Writer_t WriterPipe;
extern Writer_t WriterDVBSubtitle;
Writer_t* getWriter(char* encoding);
Writer_t *getWriter(char *encoding);
Writer_t* getDefaultVideoWriter();
Writer_t* getDefaultAudioWriter();
Writer_t* getDefaultFramebufferWriter();
Writer_t *getDefaultVideoWriter();
Writer_t *getDefaultAudioWriter();
Writer_t *getDefaultFramebufferWriter();
#endif