libeplayer3: cleanup

This commit is contained in:
martii
2013-06-08 12:05:36 +02:00
committed by Stefan Seyfried
parent 546eb23e0e
commit f5091bcd35
28 changed files with 62 additions and 468 deletions

View File

@@ -76,11 +76,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x);
#define ASS_RING_SIZE 5 #define ASS_RING_SIZE 5
#ifdef MARTII
#define ASS_FONT "/share/fonts/neutrino.ttf" #define ASS_FONT "/share/fonts/neutrino.ttf"
#else
#define ASS_FONT "/usr/share/fonts/FreeSans.ttf"
#endif
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -387,24 +383,16 @@ static void ASSThread(Context_t *context) {
continue; continue;
} }
#ifndef MARTII
getMutex(__LINE__);
#endif
//FIXME: durch den sleep bleibt die cpu usage zw. 5 und 13%, ohne //FIXME: durch den sleep bleibt die cpu usage zw. 5 und 13%, ohne
// steigt sie bei Verwendung von subtiteln bis auf 95%. // steigt sie bei Verwendung von subtiteln bis auf 95%.
// ich hoffe dadurch gehen keine subtitle verloren, wenn die playPts // ich hoffe dadurch gehen keine subtitle verloren, wenn die playPts
// durch den sleep verschlafen wird. Besser w<>re es den n<>chsten // durch den sleep verschlafen wird. Besser w<>re es den n<>chsten
// subtitel zeitpunkt zu bestimmen und solange zu schlafen. // subtitel zeitpunkt zu bestimmen und solange zu schlafen.
#ifdef MARTII
usleep(10000); usleep(10000);
if(!context->playback->mayWriteToFramebuffer) if(!context->playback->mayWriteToFramebuffer)
continue; continue;
getMutex(__LINE__); getMutex(__LINE__);
checkRegions(); checkRegions();
#else
usleep(1000);
#endif
if(ass_renderer && ass_track) if(ass_renderer && ass_track)
img = ass_render_frame(ass_renderer, ass_track, playPts / 90.0, &change); img = ass_render_frame(ass_renderer, ass_track, playPts / 90.0, &change);
@@ -429,11 +417,7 @@ static void ASSThread(Context_t *context) {
if (ass_track && ass_track->events) if (ass_track && ass_track->events)
{ {
#ifdef MARTII
undisplay = now + (ass_track->events->Duration + 500) / 90000; undisplay = now + (ass_track->events->Duration + 500) / 90000;
#else
undisplay = now + ass_track->events->Duration / 1000 + 0.5;
#endif
} }
ass_printf(100, "w %d h %d s %d x %d y %d c %d chg %d now %ld und %ld\n", ass_printf(100, "w %d h %d s %d x %d y %d c %d chg %d now %ld und %ld\n",
@@ -482,7 +466,6 @@ static void ASSThread(Context_t *context) {
* so there is hopefully installed an output callback * so there is hopefully installed an output callback
* in the subtitle output! * in the subtitle output!
*/ */
#ifdef MARTII
SubtitleOut_t sub_out; SubtitleOut_t sub_out;
sub_out.type = eSub_Gfx; sub_out.type = eSub_Gfx;
@@ -506,31 +489,6 @@ static void ASSThread(Context_t *context) {
if(context && context->playback && context->playback->isPlaying && if(context && context->playback && context->playback->isPlaying &&
context->output && context->output->subtitle) context->output && context->output->subtitle)
context->output->subtitle->Write(context, &sub_out); context->output->subtitle->Write(context, &sub_out);
#else
SubtitleOut_t out;
out.type = eSub_Gfx;
if (ass_track->events)
{
/* fixme: check values */
out.pts = ass_track->events->Start * 90.0;
out.duration = ass_track->events->Duration / 1000.0;
} else
{
out.pts = playPts;
out.duration = 10.0;
}
out.u.gfx.data = img->bitmap;
out.u.gfx.Width = img->w;
out.u.gfx.Height = img->h;
out.u.gfx.x = img->dst_x;
out.u.gfx.y = img->dst_y;
if(context && context->playback && context->playback->isPlaying &&
context->output && context->output->subtitle)
context->output->subtitle->Write(context, &out);
#endif
} }
} }
@@ -550,21 +508,15 @@ static void ASSThread(Context_t *context) {
} }
/* cleanup no longer used but not overwritten regions */ /* cleanup no longer used but not overwritten regions */
#ifdef MARTII
getMutex(__LINE__); getMutex(__LINE__);
#endif
checkRegions(); checkRegions();
#ifdef MARTII
releaseMutex(__LINE__); releaseMutex(__LINE__);
#endif
} /* while */ } /* while */
hasPlayThreadStarted = 0; hasPlayThreadStarted = 0;
ass_printf(10, "terminating\n"); ass_printf(10, "terminating\n");
#ifdef MARTII
pthread_exit(NULL); pthread_exit(NULL);
#endif
} }
/* **************************** */ /* **************************** */
@@ -642,18 +594,10 @@ int container_ass_init(Context_t *context)
} }
ass_set_use_margins(ass_renderer, 0 ); ass_set_use_margins(ass_renderer, 0 );
#ifdef MARTII
ass_set_font_scale(ass_renderer, (ass_font_scale * screen_height) / 240.0); ass_set_font_scale(ass_renderer, (ass_font_scale * screen_height) / 240.0);
#else
ass_set_font_scale(ass_renderer, ass_font_scale);
#endif
ass_set_hinting(ass_renderer, ASS_HINTING_LIGHT); ass_set_hinting(ass_renderer, ASS_HINTING_LIGHT);
#ifdef MARTII
ass_set_line_spacing(ass_renderer, (ass_line_spacing * screen_height) / 240.0); ass_set_line_spacing(ass_renderer, (ass_line_spacing * screen_height) / 240.0);
#else
ass_set_line_spacing(ass_renderer, ass_line_spacing);
#endif
ass_set_fonts(ass_renderer, ASS_FONT, "Arial", 0, NULL, 1); ass_set_fonts(ass_renderer, ASS_FONT, "Arial", 0, NULL, 1);
if(threeDMode == 0){ if(threeDMode == 0){
@@ -692,10 +636,8 @@ int container_ass_process_data(Context_t *context, SubtitleData_t* data)
ass_err("error creating ass_track\n"); ass_err("error creating ass_track\n");
return cERR_CONTAINER_ASS_ERROR; return cERR_CONTAINER_ASS_ERROR;
} }
#ifdef MARTII
ass_track->PlayResX = screen_width; ass_track->PlayResX = screen_width;
ass_track->PlayResY = screen_height; ass_track->PlayResY = screen_height;
#endif
} }
if ((data->extradata) && (first_kiss)) if ((data->extradata) && (first_kiss))

View File

@@ -36,13 +36,10 @@
#include <errno.h> #include <errno.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <pthread.h> #include <pthread.h>
#ifdef MARTII
#include <sys/prctl.h> #include <sys/prctl.h>
#endif
#include <libavutil/avutil.h> #include <libavutil/avutil.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#ifdef MARTII
#define USE_LIBSWRESAMPLE #define USE_LIBSWRESAMPLE
#ifdef USE_LIBSWRESAMPLE #ifdef USE_LIBSWRESAMPLE
# include <libswresample/swresample.h> # include <libswresample/swresample.h>
@@ -50,7 +47,6 @@
# include <libavresample/avresample.h> # include <libavresample/avresample.h>
#endif #endif
#include <libavutil/opt.h> #include <libavutil/opt.h>
#endif
#include "common.h" #include "common.h"
#include "misc.h" #include "misc.h"
@@ -114,17 +110,13 @@ static AVFormatContext* avContext = NULL;
static unsigned char isContainerRunning = 0; static unsigned char isContainerRunning = 0;
#ifdef MARTII
long long int latestPts = 0; long long int latestPts = 0;
#else
static long long int latestPts = 0;
#endif
/* ***************************** */ /* ***************************** */
/* Prototypes */ /* Prototypes */
/* ***************************** */ /* ***************************** */
static int container_ffmpeg_seek_bytes(off_t pos); static int container_ffmpeg_seek_bytes(off_t pos);
static int container_ffmpeg_seek(Context_t *context, float sec); static int container_ffmpeg_seek(Context_t *context, float sec, int absolute);
static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long int pts, float sec); static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long int pts, float sec);
static int container_ffmpeg_seek_bytes_rel(off_t start, off_t bytes); static int container_ffmpeg_seek_bytes_rel(off_t start, off_t bytes);
@@ -148,9 +140,7 @@ void releaseMutex(const char *filename, const const char *function, int line) {
static char* Codec2Encoding(enum CodecID id, int* version) static char* Codec2Encoding(enum CodecID id, int* version)
{ {
#ifdef MARTII
fprintf(stderr, "Codec ID: %.8lx\n", (long)id); fprintf(stderr, "Codec ID: %.8lx\n", (long)id);
#endif
switch (id) switch (id)
{ {
case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG1VIDEO:
@@ -201,7 +191,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
case CODEC_ID_MP3: case CODEC_ID_MP3:
return "A_MP3"; return "A_MP3";
case CODEC_ID_AAC: case CODEC_ID_AAC:
#ifdef MARTII #if 1
return "A_IPCM"; return "A_IPCM";
#else #else
return "A_AAC"; return "A_AAC";
@@ -213,7 +203,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
case CODEC_ID_WMAV1: case CODEC_ID_WMAV1:
case CODEC_ID_WMAV2: case CODEC_ID_WMAV2:
case 86056: //CODEC_ID_WMAPRO case 86056: //CODEC_ID_WMAPRO
#ifdef MARTII #if 1
return "A_IPCM"; return "A_IPCM";
#else #else
return "A_WMA"; return "A_WMA";
@@ -233,7 +223,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
#else #else
case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16LE:
#endif #endif
#ifdef MARTII #if 1
return "A_IPCM"; return "A_IPCM";
#else #else
return "A_PCM"; return "A_PCM";
@@ -352,14 +342,11 @@ static char* searchMeta(AVDictionary * metadata, char* ourTag)
/* **************************** */ /* **************************** */
static void FFMPEGThread(Context_t *context) { static void FFMPEGThread(Context_t *context) {
#ifdef MARTII
char threadname[17]; char threadname[17];
strncpy(threadname, __func__, sizeof(threadname)); strncpy(threadname, __func__, sizeof(threadname));
threadname[16] = 0; threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname); prctl (PR_SET_NAME, (unsigned long)&threadname);
#endif
AVPacket packet; AVPacket packet;
off_t currentReadPosition = 0; /* last read position */
off_t lastReverseSeek = 0; /* max address to read before seek again in reverse play */ off_t lastReverseSeek = 0; /* max address to read before seek again in reverse play */
off_t lastSeek = -1; off_t lastSeek = -1;
long long int lastPts = -1, currentVideoPts = -1, currentAudioPts = -1, showtime = 0, bofcount = 0; long long int lastPts = -1, currentVideoPts = -1, currentAudioPts = -1, showtime = 0, bofcount = 0;
@@ -369,7 +356,6 @@ static void FFMPEGThread(Context_t *context) {
int err = 0, gotlastPts = 0, audioMute = 0; int err = 0, gotlastPts = 0, audioMute = 0;
AudioVideoOut_t avOut; AudioVideoOut_t avOut;
#ifdef MARTII
#ifdef USE_LIBSWRESAMPLE #ifdef USE_LIBSWRESAMPLE
SwrContext *swr = NULL; SwrContext *swr = NULL;
#else #else
@@ -378,11 +364,6 @@ static void FFMPEGThread(Context_t *context) {
AVFrame *decoded_frame = NULL; AVFrame *decoded_frame = NULL;
int out_sample_rate = 44100; int out_sample_rate = 44100;
uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO; uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO;
#else
/* Softdecoding buffer*/
unsigned char *samples = NULL;
#endif
ffmpeg_printf(10, "\n"); ffmpeg_printf(10, "\n");
@@ -433,11 +414,7 @@ static void FFMPEGThread(Context_t *context) {
} }
#ifdef MARTII
if((err = container_ffmpeg_seek_rel(context, lastSeek, lastPts, (float) context->playback->Speed * 15)) < 0) if((err = container_ffmpeg_seek_rel(context, lastSeek, lastPts, (float) context->playback->Speed * 15)) < 0)
#else
if((err = container_ffmpeg_seek_rel(context, lastSeek, lastPts, (float) context->playback->Speed)) < 0)
#endif
{ {
ffmpeg_err( "Error seeking\n"); ffmpeg_err( "Error seeking\n");
@@ -539,18 +516,12 @@ static void FFMPEGThread(Context_t *context) {
Track_t * videoTrack = NULL; Track_t * videoTrack = NULL;
Track_t * audioTrack = NULL; Track_t * audioTrack = NULL;
Track_t * subtitleTrack = NULL; Track_t * subtitleTrack = NULL;
#ifdef MARTII
Track_t * dvbsubtitleTrack = NULL; Track_t * dvbsubtitleTrack = NULL;
Track_t * teletextTrack = NULL; Track_t * teletextTrack = NULL;
#endif #endif
int index = packet.stream_index; int ix = packet.stream_index;
#if LIBAVCODEC_VERSION_MAJOR < 54
currentReadPosition = url_ftell(avContext->pb);
#else
currentReadPosition = avio_tell(avContext->pb);
#endif
if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0) if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0)
ffmpeg_err("error getting video track\n"); ffmpeg_err("error getting video track\n");
@@ -560,18 +531,17 @@ static void FFMPEGThread(Context_t *context) {
if (context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack) < 0) if (context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack) < 0)
ffmpeg_err("error getting subtitle track\n"); ffmpeg_err("error getting subtitle track\n");
#ifdef MARTII
if (context->manager->dvbsubtitle->Command(context, MANAGER_GET_TRACK, &dvbsubtitleTrack) < 0) if (context->manager->dvbsubtitle->Command(context, MANAGER_GET_TRACK, &dvbsubtitleTrack) < 0)
ffmpeg_err("error getting dvb subtitle track\n"); ffmpeg_err("error getting dvb subtitle track\n");
if (context->manager->teletext->Command(context, MANAGER_GET_TRACK, &teletextTrack) < 0) if (context->manager->teletext->Command(context, MANAGER_GET_TRACK, &teletextTrack) < 0)
ffmpeg_err("error getting teletext track\n"); ffmpeg_err("error getting teletext track\n");
#endif
ffmpeg_printf(200, "packet.size %d - index %d\n", packet.size, index); ffmpeg_printf(200, "packet.size %d - index %d\n", packet.size, ix);
if (videoTrack != NULL) { if (videoTrack != NULL) {
if (videoTrack->Id == index) { if (videoTrack->Id == ix) {
currentVideoPts = videoTrack->pts = pts = calcPts(videoTrack->stream, &packet); currentVideoPts = videoTrack->pts = pts = calcPts(videoTrack->stream, &packet);
if ((currentVideoPts > latestPts) && (currentVideoPts != INVALID_PTS_VALUE)) if ((currentVideoPts > latestPts) && (currentVideoPts != INVALID_PTS_VALUE))
@@ -585,7 +555,7 @@ static void FFMPEGThread(Context_t *context) {
} }
#endif #endif
ffmpeg_printf(200, "VideoTrack index = %d %lld\n",index, currentVideoPts); ffmpeg_printf(200, "VideoTrack index = %d %lld\n",ix, currentVideoPts);
avOut.data = packet.data; avOut.data = packet.data;
avOut.len = packet.size; avOut.len = packet.size;
@@ -605,7 +575,7 @@ static void FFMPEGThread(Context_t *context) {
} }
if (audioTrack != NULL) { if (audioTrack != NULL) {
if (audioTrack->Id == index) { if (audioTrack->Id == ix) {
currentAudioPts = audioTrack->pts = pts = calcPts(audioTrack->stream, &packet); currentAudioPts = audioTrack->pts = pts = calcPts(audioTrack->stream, &packet);
if ((currentAudioPts > latestPts) && (!videoTrack)) if ((currentAudioPts > latestPts) && (!videoTrack))
@@ -619,7 +589,7 @@ static void FFMPEGThread(Context_t *context) {
} }
#endif #endif
ffmpeg_printf(200, "AudioTrack index = %d\n",index); ffmpeg_printf(200, "AudioTrack index = %d\n",ix);
if (audioTrack->inject_raw_pcm == 1){ if (audioTrack->inject_raw_pcm == 1){
ffmpeg_printf(200,"write audio raw pcm\n"); ffmpeg_printf(200,"write audio raw pcm\n");
@@ -651,7 +621,6 @@ static void FFMPEGThread(Context_t *context) {
else if (audioTrack->inject_as_pcm == 1) else if (audioTrack->inject_as_pcm == 1)
{ {
#ifdef MARTII
AVCodecContext *c = ((AVStream*)(audioTrack->stream))->codec; AVCodecContext *c = ((AVStream*)(audioTrack->stream))->codec;
AVPacket avpkt = packet; AVPacket avpkt = packet;
@@ -696,13 +665,11 @@ static void FFMPEGThread(Context_t *context) {
#else #else
avr = avresample_alloc_context(); avr = avresample_alloc_context();
#endif #endif
#if 1
if (c->channel_layout == 0) { if (c->channel_layout == 0) {
// FIXME -- need to guess, looks pretty much like a bug in the FFMPEG WMA decoder // FIXME -- need to guess, looks pretty much like a bug in the FFMPEG WMA decoder
c->channel_layout = AV_CH_LAYOUT_STEREO; c->channel_layout = AV_CH_LAYOUT_STEREO;
} }
#endif
out_channel_layout = c->channel_layout; out_channel_layout = c->channel_layout;
// player2 won't play mono // player2 won't play mono
out_channel_layout = (c->channel_layout == AV_CH_LAYOUT_MONO) ? AV_CH_LAYOUT_STEREO : c->channel_layout; out_channel_layout = (c->channel_layout == AV_CH_LAYOUT_MONO) ? AV_CH_LAYOUT_STEREO : c->channel_layout;
@@ -793,58 +760,6 @@ static void FFMPEGThread(Context_t *context) {
ffmpeg_err("writing data to audio device failed\n"); ffmpeg_err("writing data to audio device failed\n");
av_freep(&output); av_freep(&output);
} }
#else
int bytesDone = 0;
unsigned int samples_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
AVPacket avpkt;
avpkt = packet;
// This way the buffer is only allocated if we really need it
if(samples == NULL)
samples = (unsigned char *)malloc(samples_size);
while(avpkt.size > 0)
{
int decoded_data_size = samples_size;
bytesDone = avcodec_decode_audio3(( (AVStream*) audioTrack->stream)->codec,
(short *)(samples), &decoded_data_size, &avpkt);
if(bytesDone < 0) // Error Happend
break;
avpkt.data += bytesDone;
avpkt.size -= bytesDone;
if(decoded_data_size <= 0)
continue;
pcmPrivateData_t extradata;
extradata.uNoOfChannels = ((AVStream*) audioTrack->stream)->codec->channels;
extradata.uSampleRate = ((AVStream*) audioTrack->stream)->codec->sample_rate;
extradata.uBitsPerSample = 16;
extradata.bLittleEndian = 1;
avOut.data = samples;
avOut.len = decoded_data_size;
avOut.pts = pts;
avOut.extradata = &extradata;
avOut.extralen = sizeof(extradata);
avOut.frameRate = 0;
avOut.timeScale = 0;
avOut.width = 0;
avOut.height = 0;
avOut.type = "audio";
#ifdef reverse_playback_3
if (!context->playback->BackWard)
#endif
if (context->output->audio->Write(context, &avOut) < 0)
ffmpeg_err("writing data to audio device failed\n");
}
#endif
} }
else if (audioTrack->have_aacheader == 1) else if (audioTrack->have_aacheader == 1)
{ {
@@ -895,7 +810,7 @@ static void FFMPEGThread(Context_t *context) {
} }
if (subtitleTrack != NULL) { if (subtitleTrack != NULL) {
if (subtitleTrack->Id == index) { if (subtitleTrack->Id == ix) {
float duration=3.0; float duration=3.0;
ffmpeg_printf(100, "subtitleTrack->stream %p \n", subtitleTrack->stream); ffmpeg_printf(100, "subtitleTrack->stream %p \n", subtitleTrack->stream);
@@ -908,7 +823,7 @@ static void FFMPEGThread(Context_t *context) {
ffmpeg_printf(20, "Packet duration %d\n", packet.duration); ffmpeg_printf(20, "Packet duration %d\n", packet.duration);
ffmpeg_printf(20, "Packet convergence_duration %lld\n", packet.convergence_duration); ffmpeg_printf(20, "Packet convergence_duration %lld\n", packet.convergence_duration);
if(packet.duration != 0 && packet.duration != AV_NOPTS_VALUE ) if(packet.duration != 0) // FIXME: packet.duration is 32 bit, AV_NOPTS_VALUE is 64 bit --martii
duration=((float)packet.duration)/1000.0; duration=((float)packet.duration)/1000.0;
else if(packet.convergence_duration != 0 && packet.convergence_duration != AV_NOPTS_VALUE ) else if(packet.convergence_duration != 0 && packet.convergence_duration != AV_NOPTS_VALUE )
duration=((float)packet.convergence_duration)/1000.0; duration=((float)packet.convergence_duration)/1000.0;
@@ -991,7 +906,7 @@ static void FFMPEGThread(Context_t *context) {
SubtitleData_t data; SubtitleData_t data;
data.data = line; data.data = line;
data.len = strlen((char*)line); data.len = strlen((char*)line);
data.extradata = DEFAULT_ASS_HEAD; data.extradata = (unsigned char *) DEFAULT_ASS_HEAD;
data.extralen = strlen(DEFAULT_ASS_HEAD); data.extralen = strlen(DEFAULT_ASS_HEAD);
data.pts = pts; data.pts = pts;
data.duration = duration; data.duration = duration;
@@ -1002,7 +917,6 @@ static void FFMPEGThread(Context_t *context) {
} /* duration */ } /* duration */
} }
} }
#ifdef MARTII
if (dvbsubtitleTrack != NULL) { if (dvbsubtitleTrack != NULL) {
if (dvbsubtitleTrack->Id == index) { if (dvbsubtitleTrack->Id == index) {
currentDvbsubtitlePts = dvbsubtitleTrack->pts = pts = calcPts(dvbsubtitleTrack->stream, &packet); currentDvbsubtitlePts = dvbsubtitleTrack->pts = pts = calcPts(dvbsubtitleTrack->stream, &packet);
@@ -1049,7 +963,6 @@ static void FFMPEGThread(Context_t *context) {
} }
} }
} }
#endif
if (packet.data) if (packet.data)
av_free_packet(&packet); av_free_packet(&packet);
@@ -1064,7 +977,6 @@ static void FFMPEGThread(Context_t *context) {
} /* while */ } /* while */
#ifdef MARTII
#ifdef USE_LIBSWRESAMPLE #ifdef USE_LIBSWRESAMPLE
if (swr) { if (swr) {
swr_free(&swr); swr_free(&swr);
@@ -1076,13 +988,6 @@ static void FFMPEGThread(Context_t *context) {
avcodec_free_frame(&decoded_frame); avcodec_free_frame(&decoded_frame);
} }
#endif #endif
#else
// Freeing the allocated buffer for softdecoding
if (samples != NULL) {
free(samples);
samples = NULL;
}
#endif
hasPlayThreadStarted = 0; hasPlayThreadStarted = 0;
@@ -1092,22 +997,18 @@ static void FFMPEGThread(Context_t *context) {
/* **************************** */ /* **************************** */
/* Container part for ffmpeg */ /* Container part for ffmpeg */
/* **************************** */ /* **************************** */
#ifdef MARTII
static int terminating = 0; static int terminating = 0;
static int interrupt_cb(void *ctx) static int interrupt_cb(void *ctx)
{ {
PlaybackHandler_t *p = (PlaybackHandler_t *)ctx; PlaybackHandler_t *p = (PlaybackHandler_t *)ctx;
return p->abortRequested; return p->abortRequested;
} }
#endif
int container_ffmpeg_init(Context_t *context, char * filename) int container_ffmpeg_init(Context_t *context, char * filename)
{ {
#ifdef MARTII
int err; int err;
#else
int n, err;
#endif
ffmpeg_printf(10, ">\n"); ffmpeg_printf(10, ">\n");
@@ -1136,15 +1037,13 @@ int container_ffmpeg_init(Context_t *context, char * filename)
/* initialize ffmpeg */ /* initialize ffmpeg */
avcodec_register_all(); avcodec_register_all();
av_register_all(); av_register_all();
#ifdef MARTII //TDT
avformat_network_init(); avformat_network_init();
#endif
#ifdef MARTII
context->playback->abortRequested = 0; context->playback->abortRequested = 0;
avContext = avformat_alloc_context(); avContext = avformat_alloc_context();
avContext->interrupt_callback.callback = interrupt_cb; avContext->interrupt_callback.callback = interrupt_cb;
avContext->interrupt_callback.opaque = context->playback; avContext->interrupt_callback.opaque = context->playback;
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) { if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) {
@@ -1183,11 +1082,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
* but the file is played back well. so remove this * but the file is played back well. so remove this
* until other works are done and we can prove this. * until other works are done and we can prove this.
*/ */
#ifdef MARTII
avformat_close_input(&avContext); avformat_close_input(&avContext);
#else
av_close_input_file(avContext);
#endif
//for buffered io //for buffered io
ffmpeg_buf_free(); ffmpeg_buf_free();
//for buffered io (end) //for buffered io (end)
@@ -1196,7 +1091,6 @@ int container_ffmpeg_init(Context_t *context, char * filename)
#endif #endif
} }
#ifdef MARTII
terminating = 0; terminating = 0;
latestPts = 0; latestPts = 0;
isContainerRunning = 1; isContainerRunning = 1;
@@ -1218,7 +1112,6 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL); context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL);
if (context->manager->teletext) if (context->manager->teletext)
context->manager->teletext->Command(context, MANAGER_DEL, NULL); context->manager->teletext->Command(context, MANAGER_DEL, NULL);
#endif
ffmpeg_printf(20, "dump format\n"); ffmpeg_printf(20, "dump format\n");
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
@@ -1321,14 +1214,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
lang = av_dict_get(stream->metadata, "language", NULL, 0); lang = av_dict_get(stream->metadata, "language", NULL, 0);
#ifdef MARTII
track.Name = lang ? lang->value : "und"; track.Name = lang ? lang->value : "und";
#else
if (lang)
track.Name = strdup(lang->value);
else
track.Name = strdup("und");
#endif
ffmpeg_printf(10, "Language %s\n", track.Name); ffmpeg_printf(10, "Language %s\n", track.Name);
@@ -1349,14 +1235,6 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0; track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0;
} }
#ifndef MARTII
if(!strncmp(encoding, "A_PCM", 5))
{
track.inject_raw_pcm = 1;
ffmpeg_printf(10, " Handle inject_raw_pcm = %d\n", track.inject_as_pcm);
}
else
#endif
if(!strncmp(encoding, "A_IPCM", 6)) if(!strncmp(encoding, "A_IPCM", 6))
{ {
track.inject_as_pcm = 1; track.inject_as_pcm = 1;
@@ -1365,16 +1243,12 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
AVCodec *codec = avcodec_find_decoder(stream->codec->codec_id); AVCodec *codec = avcodec_find_decoder(stream->codec->codec_id);
//( (AVStream*) audioTrack->stream)->codec->flags |= CODEC_FLAG_TRUNCATED; //( (AVStream*) audioTrack->stream)->codec->flags |= CODEC_FLAG_TRUNCATED;
#ifdef MARTII
if(codec != NULL && !avcodec_open2(stream->codec, codec, NULL)) if(codec != NULL && !avcodec_open2(stream->codec, codec, NULL))
#else
if(codec != NULL && !avcodec_open(stream->codec, codec))
#endif
printf("AVCODEC__INIT__SUCCESS\n"); printf("AVCODEC__INIT__SUCCESS\n");
else else
printf("AVCODEC__INIT__FAILED\n"); printf("AVCODEC__INIT__FAILED\n");
} }
#ifndef MARTII #if 0
else if(stream->codec->codec_id == CODEC_ID_AAC) { else if(stream->codec->codec_id == CODEC_ID_AAC) {
ffmpeg_printf(10,"Create AAC ExtraData\n"); ffmpeg_printf(10,"Create AAC ExtraData\n");
ffmpeg_printf(10,"stream->codec->extradata_size %d\n", stream->codec->extradata_size); ffmpeg_printf(10,"stream->codec->extradata_size %d\n", stream->codec->extradata_size);
@@ -1427,11 +1301,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
} else if(stream->codec->codec_id == CODEC_ID_WMAV1 } else if(stream->codec->codec_id == CODEC_ID_WMAV1
|| stream->codec->codec_id == CODEC_ID_WMAV2 || stream->codec->codec_id == CODEC_ID_WMAV2
#ifdef MARTII
|| stream->codec->codec_id == 86056 ) //CODEC_ID_WMAPRO) //if (stream->codec->extradata_size > 0) || stream->codec->codec_id == 86056 ) //CODEC_ID_WMAPRO) //if (stream->codec->extradata_size > 0)
#else
|| 86056 ) //CODEC_ID_WMAPRO) //if (stream->codec->extradata_size > 0)
#endif
{ {
ffmpeg_printf(10,"Create WMA ExtraData\n"); ffmpeg_printf(10,"Create WMA ExtraData\n");
track.aacbuflen = 104 + stream->codec->extradata_size; track.aacbuflen = 104 + stream->codec->extradata_size;
@@ -1544,14 +1414,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
lang = av_dict_get(stream->metadata, "language", NULL, 0); lang = av_dict_get(stream->metadata, "language", NULL, 0);
#ifdef MARTII
track.Name = lang ? lang->value : "und"; track.Name = lang ? lang->value : "und";
#else
if (lang)
track.Name = strdup(lang->value);
else
track.Name = strdup("und");
#endif
ffmpeg_printf(10, "Language %s\n", track.Name); ffmpeg_printf(10, "Language %s\n", track.Name);
@@ -1583,11 +1446,8 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0; track.duration = (double) stream->duration * av_q2d(stream->time_base) * 1000.0;
} }
#ifndef MARTII
if (track.Name)
#endif
ffmpeg_printf(10, "FOUND SUBTITLE %s\n", track.Name); ffmpeg_printf(10, "FOUND SUBTITLE %s\n", track.Name);
#ifdef MARTII
if (stream->codec->codec_id == CODEC_ID_DVB_TELETEXT && context->manager->teletext) { if (stream->codec->codec_id == CODEC_ID_DVB_TELETEXT && context->manager->teletext) {
ffmpeg_printf(10, "dvb_teletext\n"); ffmpeg_printf(10, "dvb_teletext\n");
int i = 0; int i = 0;
@@ -1609,10 +1469,7 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
if (context->manager->dvbsubtitle->Command(context, MANAGER_ADD, &track) < 0) { if (context->manager->dvbsubtitle->Command(context, MANAGER_ADD, &track) < 0) {
ffmpeg_err("failed to add dvbsubtitle track %d\n", n); ffmpeg_err("failed to add dvbsubtitle track %d\n", n);
} }
} else } else if (context->manager->subtitle)
#endif
if (context->manager->subtitle)
if (context->manager->subtitle->Command(context, MANAGER_ADD, &track) < 0) { if (context->manager->subtitle->Command(context, MANAGER_ADD, &track) < 0) {
/* konfetti: fixme: is this a reason to return with error? */ /* konfetti: fixme: is this a reason to return with error? */
ffmpeg_err("failed to add subtitle track %d\n", n); ffmpeg_err("failed to add subtitle track %d\n", n);
@@ -1631,12 +1488,6 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
} /* for */ } /* for */
#ifndef MARTII
/* init */
latestPts = 0;
isContainerRunning = 1;
#endif
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
@@ -1695,10 +1546,8 @@ static int container_ffmpeg_stop(Context_t *context) {
ffmpeg_err("Container not running\n"); ffmpeg_err("Container not running\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
#ifdef MARTII
if (context->playback) if (context->playback)
context->playback->isPlaying = 0; context->playback->isPlaying = 0;
#endif
while ( (hasPlayThreadStarted != 0) && (--wait_time) > 0 ) { while ( (hasPlayThreadStarted != 0) && (--wait_time) > 0 ) {
ffmpeg_printf(10, "Waiting for ffmpeg thread to terminate itself, will try another %d times\n", wait_time); ffmpeg_printf(10, "Waiting for ffmpeg thread to terminate itself, will try another %d times\n", wait_time);
@@ -1713,26 +1562,15 @@ static int container_ffmpeg_stop(Context_t *context) {
} }
hasPlayThreadStarted = 0; hasPlayThreadStarted = 0;
#ifdef MARTII
terminating = 1; terminating = 1;
#endif
getMutex(FILENAME, __FUNCTION__,__LINE__); getMutex(FILENAME, __FUNCTION__,__LINE__);
#ifdef MARTII
if (avContext) if (avContext)
avformat_close_input(&avContext); avformat_close_input(&avContext);
#else
if (avContext != NULL) {
av_close_input_file(avContext);
avContext = NULL;
}
#endif
isContainerRunning = 0; isContainerRunning = 0;
#ifdef MARTII //TDT
avformat_network_deinit(); avformat_network_deinit();
#endif
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
@@ -1915,13 +1753,18 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
} }
static int container_ffmpeg_seek(Context_t *context, float sec) { static int container_ffmpeg_seek(Context_t *context, float sec, int absolute) {
Track_t * videoTrack = NULL; Track_t * videoTrack = NULL;
Track_t * audioTrack = NULL; Track_t * audioTrack = NULL;
Track_t * current = NULL; Track_t * current = NULL;
int flag = 0; int flag = 0;
#if !defined(VDR1722) if (absolute) {
ffmpeg_printf(10, "goto %f sec\n", sec);
if (sec < 0.0)
sec = 0.0;
} else {
ffmpeg_printf(10, "seeking %f sec\n", sec); ffmpeg_printf(10, "seeking %f sec\n", sec);
if (sec == 0.0) if (sec == 0.0)
@@ -1929,15 +1772,7 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
ffmpeg_err("sec = 0.0 ignoring\n"); ffmpeg_err("sec = 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
#else
ffmpeg_printf(10, "goto %f sec\n", sec);
if (sec < 0.0)
{
ffmpeg_err("sec < 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR;
} }
#endif
context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack); context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack);
context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack); context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
@@ -1984,27 +1819,12 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
{ {
sec *= 180000.0; sec *= 180000.0;
} }
#ifdef MARTII
if (absolute) if (absolute)
pos = sec; pos = sec;
else else
pos += sec; pos += sec;
#else
#if !defined(VDR1722)
pos += sec;
#else
pos = sec;
#endif
#endif
if (pos < 0) if (pos < 0)
{
#ifdef MARTII
pos = 0; pos = 0;
#else
ffmpeg_err("end of file reached\n");
return cERR_CONTAINER_FFMPEG_END_OF_FILE;
#endif
}
ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %f\n", pos, sec); ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %f\n", pos, sec);
@@ -2017,14 +1837,8 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
} else } else
{ {
#ifdef MARTII
if (!absolute) if (!absolute)
sec += ((float) current->pts / 90000.0f); sec += ((float) current->pts / 90000.0f);
#else
#if !defined(VDR1722)
sec += ((float) current->pts / 90000.0f);
#endif
#endif
ffmpeg_printf(10, "2. seeking to position %f sec ->time base %f %d\n", sec, av_q2d(((AVStream*) current->stream)->time_base), AV_TIME_BASE); ffmpeg_printf(10, "2. seeking to position %f sec ->time base %f %d\n", sec, av_q2d(((AVStream*) current->stream)->time_base), AV_TIME_BASE);
if (av_seek_frame(avContext, -1 /* or streamindex */, sec * AV_TIME_BASE, flag) < 0) { if (av_seek_frame(avContext, -1 /* or streamindex */, sec * AV_TIME_BASE, flag) < 0) {
@@ -2097,7 +1911,7 @@ static int container_ffmpeg_swich_subtitle(Context_t* context, int* arg)
/* Hellmaster1024: nothing to do here!*/ /* Hellmaster1024: nothing to do here!*/
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
} }
#ifdef MARTII
static int container_ffmpeg_switch_dvbsubtitle(Context_t* context, int* arg) static int container_ffmpeg_switch_dvbsubtitle(Context_t* context, int* arg)
{ {
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
@@ -2107,7 +1921,6 @@ static int container_ffmpeg_switch_teletext(Context_t* context, int* arg)
{ {
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
} }
#endif
/* konfetti comment: I dont like the mechanism of overwriting /* konfetti comment: I dont like the mechanism of overwriting
* the pointer in infostring. This lead in most cases to * the pointer in infostring. This lead in most cases to
@@ -2181,15 +1994,13 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
ffmpeg_printf(50, "Command %d\n", command); ffmpeg_printf(50, "Command %d\n", command);
#ifdef MARTII
if (command != CONTAINER_INIT && !avContext) if (command != CONTAINER_INIT && !avContext)
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
#endif
switch(command) switch(command)
{ {
case CONTAINER_INIT: { case CONTAINER_INIT: {
char * FILENAME = (char *)argument; char * filename = (char *)argument;
ret = container_ffmpeg_init(context, FILENAME); ret = container_ffmpeg_init(context, filename);
break; break;
} }
case CONTAINER_PLAY: { case CONTAINER_PLAY: {
@@ -2201,14 +2012,9 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
break; break;
} }
case CONTAINER_SEEK: { case CONTAINER_SEEK: {
#ifdef MARTII
ret = container_ffmpeg_seek(context, (float)*((float*)argument), 0); ret = container_ffmpeg_seek(context, (float)*((float*)argument), 0);
#else
ret = container_ffmpeg_seek(context, (float)*((float*)argument));
#endif
break; break;
} }
#ifdef MARTII
case CONTAINER_SEEK_ABS: { case CONTAINER_SEEK_ABS: {
ret = container_ffmpeg_seek(context, (float)*((float*)argument), -1); ret = container_ffmpeg_seek(context, (float)*((float*)argument), -1);
break; break;
@@ -2240,7 +2046,6 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
*((long long int*)argument) = latestPts; *((long long int*)argument) = latestPts;
break; break;
} }
#ifdef MARTII
case CONTAINER_SWITCH_DVBSUBTITLE: { case CONTAINER_SWITCH_DVBSUBTITLE: {
ret = container_ffmpeg_switch_dvbsubtitle(context, (int*) argument); ret = container_ffmpeg_switch_dvbsubtitle(context, (int*) argument);
break; break;
@@ -2249,7 +2054,6 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
ret = container_ffmpeg_switch_teletext(context, (int*) argument); ret = container_ffmpeg_switch_teletext(context, (int*) argument);
break; break;
} }
#endif
default: default:
ffmpeg_err("ContainerCmd %d not supported!\n", command); ffmpeg_err("ContainerCmd %d not supported!\n", command);
ret = cERR_CONTAINER_FFMPEG_ERR; ret = cERR_CONTAINER_FFMPEG_ERR;
@@ -2261,11 +2065,7 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
return ret; return ret;
} }
#ifdef MARTII
static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "flac", "mp3", "mpg", "m2ts", "vob", "wmv","wma", "asf", "mp2", "m4v", "m4a", "divx", "dat", "mpeg", "trp", "mts", "vdr", "ogg", "wav", "wtv", NULL }; static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "flac", "mp3", "mpg", "m2ts", "vob", "wmv","wma", "asf", "mp2", "m4v", "m4a", "divx", "dat", "mpeg", "trp", "mts", "vdr", "ogg", "wav", "wtv", NULL };
#else
static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "flac", "mp3", "mpg", "m2ts", "vob", "wmv","wma", "asf", "mp2", "m4v", "m4a", "divx", "dat", "mpeg", "trp", "mts", "vdr", "ogg", "wav", NULL };
#endif
Container_t FFMPEGContainer = { Container_t FFMPEGContainer = {
"FFMPEG", "FFMPEG",

View File

@@ -116,11 +116,7 @@ void data_to_manager(Context_t *context, char* Text, unsigned long long int Pts,
SubtitleData_t data; SubtitleData_t data;
data.data = line; data.data = line;
data.len = strlen((char*)line); data.len = strlen((char*)line);
#ifdef MARTII
data.extradata = (unsigned char *) DEFAULT_ASS_HEAD; data.extradata = (unsigned char *) DEFAULT_ASS_HEAD;
#else
data.extradata = DEFAULT_ASS_HEAD;
#endif
data.extralen = strlen(DEFAULT_ASS_HEAD); data.extralen = strlen(DEFAULT_ASS_HEAD);
data.pts = Pts*90; data.pts = Pts*90;
data.duration = Duration; data.duration = Duration;

View File

@@ -104,12 +104,8 @@ static int hasThreadStarted = 0;
char *SSAgetLine() char *SSAgetLine()
{ {
char *strAux = NULL, *strInput; char *strAux = NULL, *strInput;
#ifdef MARTII
char c[SSA_BUFFER_SIZE]; char c[SSA_BUFFER_SIZE];
int ch; int ch;
#else
char c[SSA_BUFFER_SIZE], ch;
#endif
int k, tam, tamAux; int k, tam, tamAux;
k = tamAux = 0; k = tamAux = 0;
@@ -162,13 +158,8 @@ char *SSAgetLine()
/* ***************************** */ /* ***************************** */
/* Worker Thread */ /* Worker Thread */
/* ***************************** */ /* ***************************** */
#ifdef MARTII
static void* SsaSubtitleThread(void *Data) { static void* SsaSubtitleThread(void *Data) {
Context_t *context = (Context_t*) Data; Context_t *context = (Context_t*) Data;
#else
static void* SsaSubtitleThread(void *data) {
Context_t *context = (Context_t*) data;
#endif
char * head =malloc(sizeof(char)*1); char * head =malloc(sizeof(char)*1);
ssa_printf(10, "\n"); ssa_printf(10, "\n");

View File

@@ -14,7 +14,5 @@ typedef struct Context_s {
ManagerHandler_t * manager; ManagerHandler_t * manager;
} Context_t; } Context_t;
#ifdef MARTII
int container_ffmpeg_update_tracks(Context_t *context, char *filename); int container_ffmpeg_update_tracks(Context_t *context, char *filename);
#endif #endif
#endif

View File

@@ -10,14 +10,13 @@ CONTAINER_CAPABILITIES,
CONTAINER_PLAY, CONTAINER_PLAY,
CONTAINER_STOP, CONTAINER_STOP,
CONTAINER_SEEK, CONTAINER_SEEK,
CONTAINER_SEEK_ABS,
CONTAINER_LENGTH, CONTAINER_LENGTH,
CONTAINER_DEL, CONTAINER_DEL,
CONTAINER_SWITCH_AUDIO, CONTAINER_SWITCH_AUDIO,
CONTAINER_SWITCH_SUBTITLE, CONTAINER_SWITCH_SUBTITLE,
#ifdef MARTII
CONTAINER_SWITCH_DVBSUBTITLE, CONTAINER_SWITCH_DVBSUBTITLE,
CONTAINER_SWITCH_TELETEXT, CONTAINER_SWITCH_TELETEXT,
#endif
CONTAINER_INFO, CONTAINER_INFO,
CONTAINER_STATUS, CONTAINER_STATUS,
CONTAINER_LAST_PTS, CONTAINER_LAST_PTS,

View File

@@ -70,10 +70,8 @@ typedef struct ManagerHandler_s {
Manager_t * audio; Manager_t * audio;
Manager_t * video; Manager_t * video;
Manager_t * subtitle; Manager_t * subtitle;
#ifdef MARTII
Manager_t * dvbsubtitle; Manager_t * dvbsubtitle;
Manager_t * teletext; Manager_t * teletext;
#endif
} ManagerHandler_t; } ManagerHandler_t;
void freeTrack(Track_t* track); void freeTrack(Track_t* track);

View File

@@ -61,16 +61,12 @@ typedef struct Output_s {
extern Output_t LinuxDvbOutput; extern Output_t LinuxDvbOutput;
extern Output_t SubtitleOutput; extern Output_t SubtitleOutput;
#ifdef MARTII
extern Output_t PipeOutput; extern Output_t PipeOutput;
#endif
static Output_t * AvailableOutput[] = { static Output_t * AvailableOutput[] = {
&LinuxDvbOutput, &LinuxDvbOutput,
&SubtitleOutput, &SubtitleOutput,
#ifdef MARTII
&PipeOutput, &PipeOutput,
#endif
NULL NULL
}; };
@@ -79,10 +75,8 @@ typedef struct OutputHandler_s {
Output_t * audio; Output_t * audio;
Output_t * video; Output_t * video;
Output_t * subtitle; Output_t * subtitle;
#ifdef MARTII
Output_t * dvbsubtitle; Output_t * dvbsubtitle;
Output_t * teletext; Output_t * teletext;
#endif
int (* Command) (/*Context_t*/void *, OutputCmd_t, void *); int (* Command) (/*Context_t*/void *, OutputCmd_t, void *);
} OutputHandler_t; } OutputHandler_t;

View File

@@ -14,11 +14,7 @@
#define PES_VERSION_FAKE_START_CODE 0x31 #define PES_VERSION_FAKE_START_CODE 0x31
#ifdef MARTII
#define MAX_PES_PACKET_SIZE (65535) #define MAX_PES_PACKET_SIZE (65535)
#else
#define MAX_PES_PACKET_SIZE 65400
#endif
/* start codes */ /* start codes */

View File

@@ -2,11 +2,7 @@
#define PLAYBACK_H_ #define PLAYBACK_H_
#include <sys/types.h> #include <sys/types.h>
#ifdef MARTII
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;
#else
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT} PlaybackCmd_t;
#endif
typedef struct PlaybackHandler_s { typedef struct PlaybackHandler_s {
char * Name; char * Name;
@@ -31,12 +27,10 @@ typedef struct PlaybackHandler_s {
unsigned char isVideo; unsigned char isVideo;
unsigned char isAudio; unsigned char isAudio;
unsigned char isSubtitle; unsigned char isSubtitle;
#ifdef MARTII
unsigned char isDvbSubtitle; unsigned char isDvbSubtitle;
unsigned char isTeletext; unsigned char isTeletext;
unsigned char mayWriteToFramebuffer; unsigned char mayWriteToFramebuffer;
unsigned char abortRequested; unsigned char abortRequested;
#endif
int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *); int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *);
char * uri; char * uri;

View File

@@ -36,10 +36,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
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]; char buf[1024];
#ifdef MARTII unsigned int x,pos=0;
unsigned
#endif
int x,pos=0;
for(x=0;x<strlen(text);x++){ for(x=0;x<strlen(text);x++){
if(text[x]=='\n'){ if(text[x]=='\n'){
buf[pos++]='\\'; buf[pos++]='\\';

View File

@@ -74,10 +74,8 @@ extern Writer_t WriterVideoH263;
extern Writer_t WriterVideoFLV; extern Writer_t WriterVideoFLV;
extern Writer_t WriterVideoVC1; extern Writer_t WriterVideoVC1;
extern Writer_t WriterFramebuffer; extern Writer_t WriterFramebuffer;
#ifdef MARTII
extern Writer_t WriterPipe; extern Writer_t WriterPipe;
extern Writer_t WriterDVBSubtitle; extern Writer_t WriterDVBSubtitle;
#endif
static Writer_t * AvailableWriter[] = { static Writer_t * AvailableWriter[] = {
&WriterAudioIPCM, &WriterAudioIPCM,

View File

@@ -24,9 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef MARTII
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#endif
#include "manager.h" #include "manager.h"
#include "common.h" #include "common.h"
@@ -179,9 +177,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
case MANAGER_LIST: { case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri); container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context); *((char***)argument) = (char **)ManagerList(context);
break; break;
} }
@@ -220,9 +216,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
case MANAGER_SET: { case MANAGER_SET: {
int id = *((int*)argument); int id = *((int*)argument);
#ifdef MARTII
// What's the argument supposed to be? apid or local index? --martii // What's the argument supposed to be? apid or local index? --martii
if (id >= TrackCount) { if (id >= TrackCount) {
int apid = id; int apid = id;
for (id = 0; id < TrackCount; id++) { for (id = 0; id < TrackCount; id++) {
@@ -230,7 +224,6 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
} }
#endif
audio_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", FILENAME, __FUNCTION__, id); audio_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", FILENAME, __FUNCTION__, id);
if (id < TrackCount) if (id < TrackCount)

View File

@@ -1,4 +1,3 @@
#ifdef MARTII
/* /*
* dvbsubtitle manager handling. * dvbsubtitle manager handling.
* *
@@ -178,9 +177,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
case MANAGER_LIST: { case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri); container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context); *((char***)argument) = (char **)ManagerList(context);
break; break;
} }
@@ -259,4 +256,3 @@ struct Manager_s DvbSubtitleManager = {
&Command, &Command,
NULL NULL
}; };
#endif

View File

@@ -40,20 +40,16 @@
extern Manager_t AudioManager; extern Manager_t AudioManager;
extern Manager_t VideoManager; extern Manager_t VideoManager;
extern Manager_t SubtitleManager; extern Manager_t SubtitleManager;
#ifdef MARTII
extern Manager_t DvbSubtitleManager; extern Manager_t DvbSubtitleManager;
extern Manager_t TeletextManager; extern Manager_t TeletextManager;
#endif
ManagerHandler_t ManagerHandler = { ManagerHandler_t ManagerHandler = {
"ManagerHandler", "ManagerHandler",
&AudioManager, &AudioManager,
&VideoManager, &VideoManager,
&SubtitleManager &SubtitleManager
#ifdef MARTII
, &DvbSubtitleManager , &DvbSubtitleManager
, &TeletextManager , &TeletextManager
#endif
}; };
/* ***************************** */ /* ***************************** */

View File

@@ -176,9 +176,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
case MANAGER_LIST: { case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri); container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context); *((char***)argument) = (char **)ManagerList(context);
break; break;
} }

View File

@@ -1,4 +1,3 @@
#ifdef MARTII
/* /*
* teletext manager handling. * teletext manager handling.
* *
@@ -178,9 +177,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
case MANAGER_LIST: { case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri); container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context); *((char***)argument) = (char **)ManagerList(context);
break; break;
} }
@@ -259,4 +256,3 @@ struct Manager_s TeletextManager = {
&Command, &Command,
NULL NULL
}; };
#endif

View File

@@ -173,9 +173,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break; break;
} }
case MANAGER_LIST: { case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri); container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context); *((char***)argument) = (char **)ManagerList(context);
break; break;
} }

View File

@@ -799,11 +799,7 @@ int LinuxDvbGetFrameCount(Context_t *context, unsigned long long int* frameCoun
linuxdvb_err("VIDEO_GET_PLAY_INFO: %s\n", strerror(errno)); linuxdvb_err("VIDEO_GET_PLAY_INFO: %s\n", strerror(errno));
ret = cERR_LINUXDVB_ERROR; ret = cERR_LINUXDVB_ERROR;
} }
#ifdef MARTII
else linuxdvb_err("V: %llu\n", playInfo.frame_count); else linuxdvb_err("V: %llu\n", playInfo.frame_count);
#else
else linuxdvb_err("V: %ull\n", playInfo.frame_count);
#endif
} }
else if (audiofd != -1) else if (audiofd != -1)
{ {
@@ -813,11 +809,7 @@ int LinuxDvbGetFrameCount(Context_t *context, unsigned long long int* frameCoun
linuxdvb_err("AUDIO_GET_PLAY_INFO: %s\n", strerror(errno)); linuxdvb_err("AUDIO_GET_PLAY_INFO: %s\n", strerror(errno));
ret = cERR_LINUXDVB_ERROR; ret = cERR_LINUXDVB_ERROR;
} }
#ifdef MARTII
else linuxdvb_err("A: %llu\n", playInfo.frame_count); else linuxdvb_err("A: %llu\n", playInfo.frame_count);
#else
else linuxdvb_err("A: %ull\n", playInfo.frame_count);
#endif
} }
else { else {
ret = cERR_LINUXDVB_ERROR; ret = cERR_LINUXDVB_ERROR;

View File

@@ -37,14 +37,9 @@
static short debug_level = 0; static short debug_level = 0;
#ifdef MARTII
#define output_printf(level, x...) do { \ #define output_printf(level, x...) do { \
if (debug_level >= level) fprintf(stderr, x); } while (0) if (debug_level >= level) fprintf(stderr, x); } while (0)
#else #else
#define output_printf(level, x...) do { \
if (debug_level >= level) printf(x); } while (0)
#endif
#else
#define output_printf(level, x...) #define output_printf(level, x...)
#endif #endif
@@ -102,7 +97,6 @@ static void OutputAdd(Context_t *context, char * port) {
for (i = 0; AvailableOutput[i] != NULL; i++) for (i = 0; AvailableOutput[i] != NULL; i++)
for (j = 0; AvailableOutput[i]->Capabilities[j] != NULL; j++) for (j = 0; AvailableOutput[i]->Capabilities[j] != NULL; j++)
#ifdef MARTII
if (!strcmp(AvailableOutput[i]->Capabilities[j], port)) { if (!strcmp(AvailableOutput[i]->Capabilities[j], port)) {
if (!strcmp("audio", port)) { if (!strcmp("audio", port)) {
context->output->audio = AvailableOutput[i]; context->output->audio = AvailableOutput[i];
@@ -125,17 +119,6 @@ static void OutputAdd(Context_t *context, char * port) {
return; return;
} }
} }
#else
if (!strcmp(AvailableOutput[i]->Capabilities[j], port)) {
if (!strcmp("audio", port))
context->output->audio = AvailableOutput[i];
else if (!strcmp("video", port))
context->output->video = AvailableOutput[i];
else if (!strcmp("subtitle", port))
context->output->subtitle = AvailableOutput[i];
break;
}
#endif
} }
static void OutputDel(Context_t *context, char * port) { static void OutputDel(Context_t *context, char * port) {
@@ -147,12 +130,10 @@ static void OutputDel(Context_t *context, char * port) {
context->output->video = NULL; context->output->video = NULL;
else if (!strcmp("subtitle", port)) else if (!strcmp("subtitle", port))
context->output->subtitle = NULL; context->output->subtitle = NULL;
#ifdef MARTII
else if (!strcmp("dvbsubtitle", port)) else if (!strcmp("dvbsubtitle", port))
context->output->dvbsubtitle = NULL; context->output->dvbsubtitle = NULL;
else if (!strcmp("teletext", port)) else if (!strcmp("teletext", port))
context->output->teletext = NULL; context->output->teletext = NULL;
#endif
} }
@@ -171,12 +152,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
ret |= context->output->audio->Command(context, OUTPUT_OPEN, "audio"); ret |= context->output->audio->Command(context, OUTPUT_OPEN, "audio");
if (context->playback->isSubtitle) if (context->playback->isSubtitle)
ret |= context->output->subtitle->Command(context, OUTPUT_OPEN, "subtitle"); ret |= context->output->subtitle->Command(context, OUTPUT_OPEN, "subtitle");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -189,12 +168,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
ret |= context->output->audio->Command(context, OUTPUT_CLOSE, "audio"); ret |= context->output->audio->Command(context, OUTPUT_CLOSE, "audio");
if (context->playback->isSubtitle) if (context->playback->isSubtitle)
ret |= context->output->subtitle->Command(context, OUTPUT_CLOSE, "subtitle"); ret |= context->output->subtitle->Command(context, OUTPUT_CLOSE, "subtitle");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -224,12 +201,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
if (context->playback->isSubtitle) if (context->playback->isSubtitle)
ret = context->output->subtitle->Command(context, OUTPUT_PLAY, "subtitle"); ret = context->output->subtitle->Command(context, OUTPUT_PLAY, "subtitle");
} }
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} }
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
@@ -243,12 +218,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
ret |= context->output->audio->Command(context, OUTPUT_STOP, "audio"); ret |= context->output->audio->Command(context, OUTPUT_STOP, "audio");
if (context->playback->isSubtitle) if (context->playback->isSubtitle)
ret |= context->output->subtitle->Command(context, OUTPUT_STOP, "subtitle"); ret |= context->output->subtitle->Command(context, OUTPUT_STOP, "subtitle");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -307,12 +280,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
ret |= context->output->audio->Command(context, OUTPUT_CONTINUE, "audio"); ret |= context->output->audio->Command(context, OUTPUT_CONTINUE, "audio");
//if (context->playback->isSubtitle) //if (context->playback->isSubtitle)
// ret |= context->output->subtitle->Command(context, OUTPUT_CONTINUE, "subtitle"); // ret |= context->output->subtitle->Command(context, OUTPUT_CONTINUE, "subtitle");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -333,12 +304,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
ret |= context->output->audio->Command(context, OUTPUT_CLEAR, "audio"); ret |= context->output->audio->Command(context, OUTPUT_CLEAR, "audio");
//if (context->playback->isSubtitle && (argument == NULL || *(char *) argument == 's')) //if (context->playback->isSubtitle && (argument == NULL || *(char *) argument == 's'))
// ret |= context->output->subtitle->Command(context, OUTPUT_CLEAR, "subtitle"); // ret |= context->output->subtitle->Command(context, OUTPUT_CLEAR, "subtitle");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -361,12 +330,10 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
return context->output->audio->Command(context, OUTPUT_SWITCH, "audio"); return context->output->audio->Command(context, OUTPUT_SWITCH, "audio");
if (context->playback->isVideo) if (context->playback->isVideo)
return context->output->video->Command(context, OUTPUT_SWITCH, "video"); return context->output->video->Command(context, OUTPUT_SWITCH, "video");
#ifdef MARTII
if (context->playback->isDvbSubtitle) if (context->playback->isDvbSubtitle)
ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle"); ret |= context->output->dvbsubtitle->Command(context, command, "dvbsubtitle");
if (context->playback->isTeletext) if (context->playback->isTeletext)
ret |= context->output->teletext->Command(context, command, "teletext"); ret |= context->output->teletext->Command(context, command, "teletext");
#endif
} else } else
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
@@ -427,9 +394,7 @@ OutputHandler_t OutputHandler = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
#ifdef MARTII
NULL, // dvbsubtitle NULL, // dvbsubtitle
NULL, // teletext NULL, // teletext
#endif
&Command &Command
}; };

View File

@@ -1,4 +1,3 @@
#ifdef MARTII
/* /*
* Pipe Output handling. * Pipe Output handling.
* *
@@ -452,4 +451,3 @@ struct Output_s PipeOutput = {
&Write, &Write,
PipeCapabilities PipeCapabilities
}; };
#endif

View File

@@ -597,11 +597,7 @@ static int Write(void* _context, void *data) {
return cERR_SUBTITLE_NO_ERROR; return cERR_SUBTITLE_NO_ERROR;
} }
#ifdef MARTII
static int subtitle_Open(Context_t* context) { static int subtitle_Open(Context_t* context) {
#else
static int subtitle_Open(context) {
#endif
int i; int i;
subtitle_printf(10, "\n"); subtitle_printf(10, "\n");
@@ -694,11 +690,7 @@ static int subtitle_Play(Context_t* context) {
return cERR_SUBTITLE_NO_ERROR; return cERR_SUBTITLE_NO_ERROR;
} }
#ifdef MARTII
static int subtitle_Stop(Context_t* context) { static int subtitle_Stop(Context_t* context) {
#else
static int subtitle_Stop(context) {
#endif
int wait_time = 20; int wait_time = 20;
int i; int i;

View File

@@ -37,9 +37,7 @@
#include <asm/types.h> #include <asm/types.h>
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
#ifdef MARTII
#include <sys/uio.h> #include <sys/uio.h>
#endif
#include "common.h" #include "common.h"
#include "output.h" #include "output.h"

View File

@@ -101,19 +101,8 @@ static int reset()
static int writeData(void* _call) static int writeData(void* _call)
{ {
#ifndef MARTII
unsigned char r;
unsigned char g;
unsigned char b;
#endif
unsigned char a; unsigned char a;
#ifndef MARTII
int x,y;
#endif
int res = 0; int res = 0;
#ifndef MARTII
unsigned char* dst;
#endif
WriterFBCallData_t* call = (WriterFBCallData_t*) _call; WriterFBCallData_t* call = (WriterFBCallData_t*) _call;
@@ -163,7 +152,7 @@ static int writeData(void* _call)
{ {
k = ((unsigned)src[x]) * opacity / 255; k = ((unsigned)src[x]) * opacity / 255;
ck = 255 - k; ck = 255 - k;
#ifdef MARTII // or __sh__, or !HAVE_TRIPLEDRAGON #if HAVE_SPARK_HARDWARE
*dst++ = 0; *dst++ = 0;
t = *dst; t = *dst;
*dst++ = (k*r + ck*t) / 255; *dst++ = (k*r + ck*t) / 255;
@@ -187,9 +176,7 @@ static int writeData(void* _call)
} }
} else } else
{ {
#ifdef MARTII
int y; int y;
#endif
for (y = 0; y < call->Height; y++) for (y = 0; y < call->Height; y++)
memset(call->destination + ((call->y + y) * call->destStride) + call->x * 4, 0, call->Width * 4); memset(call->destination + ((call->y + y) * call->destStride) + call->x * 4, 0, call->Width * 4);
} }

View File

@@ -89,9 +89,7 @@ static const unsigned char clpcm_pes[18] = { 0x00, 0x00, 0x01, 0xBD, //start c
0x1E, 0x60, 0x0A, //first pes only, 0xFF after 0x1E, 0x60, 0x0A, //first pes only, 0xFF after
0xFF 0xFF
}; };
#ifdef MARTII
// reference: search for TypeLpcmDVDAudio in player/frame_parser/frame_parser_audio_lpcm.cpp // reference: search for TypeLpcmDVDAudio in player/frame_parser/frame_parser_audio_lpcm.cpp
#endif
static const unsigned char clpcm_prv[14] = { 0xA0, //sub_stream_id static const unsigned char clpcm_prv[14] = { 0xA0, //sub_stream_id
0, 0, //resvd and UPC_EAN_ISRC stuff, unused 0, 0, //resvd and UPC_EAN_ISRC stuff, unused
0x0A, //private header length 0x0A, //private header length

View File

@@ -93,11 +93,7 @@ int InsertPesHeader (unsigned char *data, int size, unsigned char stream_id, uns
#if 0 #if 0
/* does not seem to hurt, at least with h264 data...? */ /* does not seem to hurt, at least with h264 data...? */
if (size > MAX_PES_PACKET_SIZE) if (size > MAX_PES_PACKET_SIZE)
#ifdef MARTII
size = 0; // unbounded size = 0; // unbounded
#else
printf("%s: Packet bigger than 63.9K eeeekkkkk\n",__FUNCTION__);
#endif
PutBits(&ld2,0x0 ,8); PutBits(&ld2,0x0 ,8);
PutBits(&ld2,0x0 ,8); PutBits(&ld2,0x0 ,8);

View File

@@ -261,7 +261,7 @@ static int writeData(void* _call)
iov[1].iov_base = call->data + Position; iov[1].iov_base = call->data + Position;
iov[1].iov_len = PacketLength; iov[1].iov_len = PacketLength;
size_t l = writev(call->fd, iov, 2); ssize_t l = writev(call->fd, iov, 2);
if (l < 0) { if (l < 0) {
len = l; len = l;
break; break;

View File

@@ -84,10 +84,8 @@ static void SupervisorThread(Context_t *context) {
{ {
if (context->container->selectedContainer != NULL) if (context->container->selectedContainer != NULL)
context->container->selectedContainer->Command(context, CONTAINER_STATUS, &status); context->container->selectedContainer->Command(context, CONTAINER_STATUS, &status);
#ifdef MARTII
else else
dieNow = 1; dieNow = 1;
#endif
if (context->container->selectedContainer != NULL) if (context->container->selectedContainer != NULL)
context->container->selectedContainer->Command(context, CONTAINER_LAST_PTS, &lastPts); context->container->selectedContainer->Command(context, CONTAINER_LAST_PTS, &lastPts);
@@ -342,10 +340,8 @@ static int PlaybackClose(Context_t *context) {
context->manager->audio->Command(context, MANAGER_DEL, NULL); context->manager->audio->Command(context, MANAGER_DEL, NULL);
context->manager->video->Command(context, MANAGER_DEL, NULL); context->manager->video->Command(context, MANAGER_DEL, NULL);
context->manager->subtitle->Command(context, MANAGER_DEL, NULL); context->manager->subtitle->Command(context, MANAGER_DEL, NULL);
#ifdef MARTII
context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL); context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL);
context->manager->teletext->Command(context, MANAGER_DEL, NULL); context->manager->teletext->Command(context, MANAGER_DEL, NULL);
#endif
context->playback->isPaused = 0; context->playback->isPaused = 0;
context->playback->isPlaying = 0; context->playback->isPlaying = 0;
@@ -771,7 +767,7 @@ static int PlaybackSlowMotion(Context_t *context,int* speed) {
return ret; return ret;
} }
static int PlaybackSeek(Context_t *context, float * pos) { static int PlaybackSeek(Context_t *context, float * pos, int absolute) {
int ret = cERR_PLAYBACK_NO_ERROR; int ret = cERR_PLAYBACK_NO_ERROR;
playback_printf(10, "pos: %f\n", *pos); playback_printf(10, "pos: %f\n", *pos);
@@ -781,6 +777,9 @@ static int PlaybackSeek(Context_t *context, float * pos) {
context->output->Command(context, OUTPUT_CLEAR, NULL); context->output->Command(context, OUTPUT_CLEAR, NULL);
if (absolute)
context->container->selectedContainer->Command(context, CONTAINER_SEEK_ABS, pos);
else
context->container->selectedContainer->Command(context, CONTAINER_SEEK, pos); context->container->selectedContainer->Command(context, CONTAINER_SEEK, pos);
context->playback->isSeeking = 0; context->playback->isSeeking = 0;
@@ -841,11 +840,7 @@ static int PlaybackLength(Context_t *context, double* length) {
playback_printf(20, "\n"); playback_printf(20, "\n");
#ifdef MARTII
*length = -1; *length = -1;
#else
*length = 0;
#endif
if (context->playback->isPlaying) { if (context->playback->isPlaying) {
if (context->container && context->container->selectedContainer) if (context->container && context->container->selectedContainer)
@@ -907,15 +902,10 @@ static int PlaybackSwitchSubtitle(Context_t *context, int* track) {
if (context->manager && context->manager->subtitle) { if (context->manager && context->manager->subtitle) {
int trackid; int trackid;
#ifdef MARTII
if (context->manager->subtitle->Command(context, *track == 0xffff ? MANAGER_DEL : MANAGER_SET, track) < 0) if (context->manager->subtitle->Command(context, *track == 0xffff ? MANAGER_DEL : MANAGER_SET, track) < 0)
#else
if (context->manager->subtitle->Command(context, MANAGER_SET, track) < 0)
#endif
{ {
playback_err("manager set track failed\n"); playback_err("manager set track failed\n");
} }
#ifdef MARTII
if (*track == 0xffff) { if (*track == 0xffff) {
//CHECK FOR SUBTITLES //CHECK FOR SUBTITLES
if (context->container && context->container->textSrtContainer) if (context->container && context->container->textSrtContainer)
@@ -927,7 +917,6 @@ static int PlaybackSwitchSubtitle(Context_t *context, int* track) {
if (context->container && context->container->assContainer) if (context->container && context->container->assContainer)
context->container->assContainer->Command(context, CONTAINER_INIT, NULL); context->container->assContainer->Command(context, CONTAINER_INIT, NULL);
} }
#endif
context->manager->subtitle->Command(context, MANAGER_GET, &trackid); context->manager->subtitle->Command(context, MANAGER_GET, &trackid);
/* konfetti: I make this hack a little bit nicer, /* konfetti: I make this hack a little bit nicer,
@@ -964,7 +953,7 @@ static int PlaybackSwitchSubtitle(Context_t *context, int* track) {
return ret; return ret;
} }
#ifdef MARTII
static int PlaybackSwitchDVBSubtitle(Context_t *context, int* pid) { static int PlaybackSwitchDVBSubtitle(Context_t *context, int* pid) {
int ret = cERR_PLAYBACK_NO_ERROR; int ret = cERR_PLAYBACK_NO_ERROR;
@@ -1006,7 +995,6 @@ static int PlaybackSwitchTeletext(Context_t *context, int* pid) {
return ret; return ret;
} }
#endif
static int PlaybackInfo(Context_t *context, char** infoString) { static int PlaybackInfo(Context_t *context, char** infoString) {
int ret = cERR_PLAYBACK_NO_ERROR; int ret = cERR_PLAYBACK_NO_ERROR;
@@ -1068,7 +1056,11 @@ static int Command(void* _context, PlaybackCmd_t command, void * argument) {
break; break;
} }
case PLAYBACK_SEEK: { case PLAYBACK_SEEK: {
ret = PlaybackSeek(context, (float*)argument); ret = PlaybackSeek(context, (float*)argument, 0);
break;
}
case PLAYBACK_SEEK_ABS: {
ret = PlaybackSeek(context, (float*)argument, -1);
break; break;
} }
case PLAYBACK_PTS: { // 10 case PLAYBACK_PTS: { // 10
@@ -1103,7 +1095,6 @@ static int Command(void* _context, PlaybackCmd_t command, void * argument) {
ret = PlaybackGetFrameCount(context, (unsigned long long int*)argument); ret = PlaybackGetFrameCount(context, (unsigned long long int*)argument);
break; break;
} }
#ifdef MARTII
case PLAYBACK_SWITCH_DVBSUBTITLE: { case PLAYBACK_SWITCH_DVBSUBTITLE: {
ret = PlaybackSwitchDVBSubtitle(context, (int*)argument); ret = PlaybackSwitchDVBSubtitle(context, (int*)argument);
break; break;
@@ -1122,7 +1113,6 @@ static int Command(void* _context, PlaybackCmd_t command, void * argument) {
ret = cERR_PLAYBACK_NO_ERROR; ret = cERR_PLAYBACK_NO_ERROR;
break; break;
} }
#endif
default: default:
playback_err("PlaybackCmd %d not supported!\n", command); playback_err("PlaybackCmd %d not supported!\n", command);
ret = cERR_PLAYBACK_ERROR; ret = cERR_PLAYBACK_ERROR;
@@ -1153,12 +1143,10 @@ PlaybackHandler_t PlaybackHandler = {
0, 0,
0, 0,
0, 0,
#ifdef MARTII
0, 0,
0, 0,
1, 1,
0, 0,
#endif
&Command, &Command,
"", "",
0, 0,