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
#ifdef MARTII
#define ASS_FONT "/share/fonts/neutrino.ttf"
#else
#define ASS_FONT "/usr/share/fonts/FreeSans.ttf"
#endif
/* ***************************** */
/* Types */
@@ -387,24 +383,16 @@ static void ASSThread(Context_t *context) {
continue;
}
#ifndef MARTII
getMutex(__LINE__);
#endif
//FIXME: durch den sleep bleibt die cpu usage zw. 5 und 13%, ohne
// steigt sie bei Verwendung von subtiteln bis auf 95%.
// ich hoffe dadurch gehen keine subtitle verloren, wenn die playPts
// durch den sleep verschlafen wird. Besser w<>re es den n<>chsten
// subtitel zeitpunkt zu bestimmen und solange zu schlafen.
#ifdef MARTII
usleep(10000);
if(!context->playback->mayWriteToFramebuffer)
continue;
getMutex(__LINE__);
checkRegions();
#else
usleep(1000);
#endif
if(ass_renderer && ass_track)
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)
{
#ifdef MARTII
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",
@@ -482,7 +466,6 @@ static void ASSThread(Context_t *context) {
* so there is hopefully installed an output callback
* in the subtitle output!
*/
#ifdef MARTII
SubtitleOut_t sub_out;
sub_out.type = eSub_Gfx;
@@ -506,31 +489,6 @@ static void ASSThread(Context_t *context) {
if(context && context->playback && context->playback->isPlaying &&
context->output && context->output->subtitle)
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 */
#ifdef MARTII
getMutex(__LINE__);
#endif
checkRegions();
#ifdef MARTII
releaseMutex(__LINE__);
#endif
} /* while */
hasPlayThreadStarted = 0;
ass_printf(10, "terminating\n");
#ifdef MARTII
pthread_exit(NULL);
#endif
}
/* **************************** */
@@ -642,18 +594,10 @@ int container_ass_init(Context_t *context)
}
ass_set_use_margins(ass_renderer, 0 );
#ifdef MARTII
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);
#ifdef MARTII
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);
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");
return cERR_CONTAINER_ASS_ERROR;
}
#ifdef MARTII
ass_track->PlayResX = screen_width;
ass_track->PlayResY = screen_height;
#endif
}
if ((data->extradata) && (first_kiss))

View File

@@ -36,21 +36,17 @@
#include <errno.h>
#include <sys/poll.h>
#include <pthread.h>
#ifdef MARTII
#include <sys/prctl.h>
#endif
#include <libavutil/avutil.h>
#include <libavformat/avformat.h>
#ifdef MARTII
#define USE_LIBSWRESAMPLE
# ifdef USE_LIBSWRESAMPLE
# include <libswresample/swresample.h>
# else
# include <libavresample/avresample.h>
# endif
# include <libavutil/opt.h>
#ifdef USE_LIBSWRESAMPLE
# include <libswresample/swresample.h>
#else
# include <libavresample/avresample.h>
#endif
#include <libavutil/opt.h>
#include "common.h"
#include "misc.h"
@@ -114,17 +110,13 @@ static AVFormatContext* avContext = NULL;
static unsigned char isContainerRunning = 0;
#ifdef MARTII
long long int latestPts = 0;
#else
static long long int latestPts = 0;
#endif
/* ***************************** */
/* Prototypes */
/* ***************************** */
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_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)
{
#ifdef MARTII
fprintf(stderr, "Codec ID: %.8lx\n", (long)id);
#endif
switch (id)
{
case CODEC_ID_MPEG1VIDEO:
@@ -201,7 +191,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
case CODEC_ID_MP3:
return "A_MP3";
case CODEC_ID_AAC:
#ifdef MARTII
#if 1
return "A_IPCM";
#else
return "A_AAC";
@@ -213,7 +203,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
case CODEC_ID_WMAV1:
case CODEC_ID_WMAV2:
case 86056: //CODEC_ID_WMAPRO
#ifdef MARTII
#if 1
return "A_IPCM";
#else
return "A_WMA";
@@ -233,7 +223,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
#else
case CODEC_ID_PCM_S16LE:
#endif
#ifdef MARTII
#if 1
return "A_IPCM";
#else
return "A_PCM";
@@ -352,14 +342,11 @@ static char* searchMeta(AVDictionary * metadata, char* ourTag)
/* **************************** */
static void FFMPEGThread(Context_t *context) {
#ifdef MARTII
char threadname[17];
strncpy(threadname, __func__, sizeof(threadname));
threadname[16] = 0;
prctl (PR_SET_NAME, (unsigned long)&threadname);
#endif
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 lastSeek = -1;
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;
AudioVideoOut_t avOut;
#ifdef MARTII
#ifdef USE_LIBSWRESAMPLE
SwrContext *swr = NULL;
#else
@@ -378,11 +364,6 @@ static void FFMPEGThread(Context_t *context) {
AVFrame *decoded_frame = NULL;
int out_sample_rate = 44100;
uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO;
#else
/* Softdecoding buffer*/
unsigned char *samples = NULL;
#endif
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)
#else
if((err = container_ffmpeg_seek_rel(context, lastSeek, lastPts, (float) context->playback->Speed)) < 0)
#endif
{
ffmpeg_err( "Error seeking\n");
@@ -539,18 +516,12 @@ static void FFMPEGThread(Context_t *context) {
Track_t * videoTrack = NULL;
Track_t * audioTrack = NULL;
Track_t * subtitleTrack = NULL;
#ifdef MARTII
Track_t * dvbsubtitleTrack = NULL;
Track_t * teletextTrack = NULL;
#endif
int index = packet.stream_index;
#if LIBAVCODEC_VERSION_MAJOR < 54
currentReadPosition = url_ftell(avContext->pb);
#else
currentReadPosition = avio_tell(avContext->pb);
#endif
int ix = packet.stream_index;
if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0)
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)
ffmpeg_err("error getting subtitle track\n");
#ifdef MARTII
if (context->manager->dvbsubtitle->Command(context, MANAGER_GET_TRACK, &dvbsubtitleTrack) < 0)
ffmpeg_err("error getting dvb subtitle track\n");
if (context->manager->teletext->Command(context, MANAGER_GET_TRACK, &teletextTrack) < 0)
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->Id == index) {
if (videoTrack->Id == ix) {
currentVideoPts = videoTrack->pts = pts = calcPts(videoTrack->stream, &packet);
if ((currentVideoPts > latestPts) && (currentVideoPts != INVALID_PTS_VALUE))
@@ -585,7 +555,7 @@ static void FFMPEGThread(Context_t *context) {
}
#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.len = packet.size;
@@ -605,7 +575,7 @@ static void FFMPEGThread(Context_t *context) {
}
if (audioTrack != NULL) {
if (audioTrack->Id == index) {
if (audioTrack->Id == ix) {
currentAudioPts = audioTrack->pts = pts = calcPts(audioTrack->stream, &packet);
if ((currentAudioPts > latestPts) && (!videoTrack))
@@ -619,7 +589,7 @@ static void FFMPEGThread(Context_t *context) {
}
#endif
ffmpeg_printf(200, "AudioTrack index = %d\n",index);
ffmpeg_printf(200, "AudioTrack index = %d\n",ix);
if (audioTrack->inject_raw_pcm == 1){
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)
{
#ifdef MARTII
AVCodecContext *c = ((AVStream*)(audioTrack->stream))->codec;
AVPacket avpkt = packet;
@@ -696,13 +665,11 @@ static void FFMPEGThread(Context_t *context) {
#else
avr = avresample_alloc_context();
#endif
#if 1
if (c->channel_layout == 0) {
// FIXME -- need to guess, looks pretty much like a bug in the FFMPEG WMA decoder
c->channel_layout = AV_CH_LAYOUT_STEREO;
}
#endif
out_channel_layout = c->channel_layout;
// player2 won't play mono
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");
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)
{
@@ -895,7 +810,7 @@ static void FFMPEGThread(Context_t *context) {
}
if (subtitleTrack != NULL) {
if (subtitleTrack->Id == index) {
if (subtitleTrack->Id == ix) {
float duration=3.0;
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 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;
else if(packet.convergence_duration != 0 && packet.convergence_duration != AV_NOPTS_VALUE )
duration=((float)packet.convergence_duration)/1000.0;
@@ -991,7 +906,7 @@ static void FFMPEGThread(Context_t *context) {
SubtitleData_t data;
data.data = 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.pts = pts;
data.duration = duration;
@@ -1002,7 +917,6 @@ static void FFMPEGThread(Context_t *context) {
} /* duration */
}
}
#ifdef MARTII
if (dvbsubtitleTrack != NULL) {
if (dvbsubtitleTrack->Id == index) {
currentDvbsubtitlePts = dvbsubtitleTrack->pts = pts = calcPts(dvbsubtitleTrack->stream, &packet);
@@ -1049,7 +963,6 @@ static void FFMPEGThread(Context_t *context) {
}
}
}
#endif
if (packet.data)
av_free_packet(&packet);
@@ -1064,24 +977,16 @@ static void FFMPEGThread(Context_t *context) {
} /* while */
#ifdef MARTII
# ifdef USE_LIBSWRESAMPLE
#ifdef USE_LIBSWRESAMPLE
if (swr) {
swr_free(&swr);
}
# else
#else
if (avr) {
avresample_close(avr);
avresample_free(&avr);
avcodec_free_frame(&decoded_frame);
}
# endif
#else
// Freeing the allocated buffer for softdecoding
if (samples != NULL) {
free(samples);
samples = NULL;
}
#endif
hasPlayThreadStarted = 0;
@@ -1092,22 +997,18 @@ static void FFMPEGThread(Context_t *context) {
/* **************************** */
/* Container part for ffmpeg */
/* **************************** */
#ifdef MARTII
static int terminating = 0;
static int interrupt_cb(void *ctx)
{
PlaybackHandler_t *p = (PlaybackHandler_t *)ctx;
return p->abortRequested;
}
#endif
int container_ffmpeg_init(Context_t *context, char * filename)
{
#ifdef MARTII
int err;
#else
int n, err;
#endif
ffmpeg_printf(10, ">\n");
@@ -1136,15 +1037,13 @@ int container_ffmpeg_init(Context_t *context, char * filename)
/* initialize ffmpeg */
avcodec_register_all();
av_register_all();
#ifdef MARTII //TDT
avformat_network_init();
#endif
#ifdef MARTII
context->playback->abortRequested = 0;
avContext = avformat_alloc_context();
avContext->interrupt_callback.callback = interrupt_cb;
avContext->interrupt_callback.opaque = context->playback;
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54
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
* until other works are done and we can prove this.
*/
#ifdef MARTII
avformat_close_input(&avContext);
#else
av_close_input_file(avContext);
#endif
//for buffered io
ffmpeg_buf_free();
//for buffered io (end)
@@ -1196,7 +1091,6 @@ int container_ffmpeg_init(Context_t *context, char * filename)
#endif
}
#ifdef MARTII
terminating = 0;
latestPts = 0;
isContainerRunning = 1;
@@ -1218,7 +1112,6 @@ int container_ffmpeg_update_tracks(Context_t *context, char *filename)
context->manager->dvbsubtitle->Command(context, MANAGER_DEL, NULL);
if (context->manager->teletext)
context->manager->teletext->Command(context, MANAGER_DEL, NULL);
#endif
ffmpeg_printf(20, "dump format\n");
#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);
#ifdef MARTII
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);
@@ -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;
}
#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))
{
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);
//( (AVStream*) audioTrack->stream)->codec->flags |= CODEC_FLAG_TRUNCATED;
#ifdef MARTII
if(codec != NULL && !avcodec_open2(stream->codec, codec, NULL))
#else
if(codec != NULL && !avcodec_open(stream->codec, codec))
#endif
printf("AVCODEC__INIT__SUCCESS\n");
else
printf("AVCODEC__INIT__FAILED\n");
}
#ifndef MARTII
#if 0
else if(stream->codec->codec_id == CODEC_ID_AAC) {
ffmpeg_printf(10,"Create AAC ExtraData\n");
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
|| stream->codec->codec_id == CODEC_ID_WMAV2
#ifdef MARTII
|| 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");
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);
#ifdef MARTII
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);
@@ -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;
}
#ifndef MARTII
if (track.Name)
#endif
ffmpeg_printf(10, "FOUND SUBTITLE %s\n", track.Name);
#ifdef MARTII
ffmpeg_printf(10, "FOUND SUBTITLE %s\n", track.Name);
if (stream->codec->codec_id == CODEC_ID_DVB_TELETEXT && context->manager->teletext) {
ffmpeg_printf(10, "dvb_teletext\n");
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) {
ffmpeg_err("failed to add dvbsubtitle track %d\n", n);
}
} else
#endif
if (context->manager->subtitle)
} else if (context->manager->subtitle)
if (context->manager->subtitle->Command(context, MANAGER_ADD, &track) < 0) {
/* konfetti: fixme: is this a reason to return with error? */
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 */
#ifndef MARTII
/* init */
latestPts = 0;
isContainerRunning = 1;
#endif
releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_NO_ERROR;
@@ -1695,10 +1546,8 @@ static int container_ffmpeg_stop(Context_t *context) {
ffmpeg_err("Container not running\n");
return cERR_CONTAINER_FFMPEG_ERR;
}
#ifdef MARTII
if (context->playback)
context->playback->isPlaying = 0;
#endif
while ( (hasPlayThreadStarted != 0) && (--wait_time) > 0 ) {
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;
#ifdef MARTII
terminating = 1;
#endif
getMutex(FILENAME, __FUNCTION__,__LINE__);
#ifdef MARTII
if (avContext)
avformat_close_input(&avContext);
#else
if (avContext != NULL) {
av_close_input_file(avContext);
avContext = NULL;
}
#endif
isContainerRunning = 0;
#ifdef MARTII //TDT
avformat_network_deinit();
#endif
releaseMutex(FILENAME, __FUNCTION__,__LINE__);
@@ -1915,29 +1753,26 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
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 * audioTrack = NULL;
Track_t * current = NULL;
int flag = 0;
#if !defined(VDR1722)
ffmpeg_printf(10, "seeking %f sec\n", sec);
if (absolute) {
ffmpeg_printf(10, "goto %f sec\n", sec);
if (sec == 0.0)
{
ffmpeg_err("sec = 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR;
}
#else
ffmpeg_printf(10, "goto %f sec\n", sec);
if (sec < 0.0)
sec = 0.0;
} else {
ffmpeg_printf(10, "seeking %f sec\n", sec);
if (sec < 0.0)
{
ffmpeg_err("sec < 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR;
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->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
@@ -1984,27 +1819,12 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
{
sec *= 180000.0;
}
#ifdef MARTII
if (absolute)
pos = sec;
else
pos += sec;
#else
#if !defined(VDR1722)
pos += sec;
#else
pos = sec;
#endif
#endif
if (pos < 0)
{
#ifdef MARTII
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);
@@ -2017,14 +1837,8 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
} else
{
#ifdef MARTII
if (!absolute)
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);
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!*/
return cERR_CONTAINER_FFMPEG_NO_ERROR;
}
#ifdef MARTII
static int container_ffmpeg_switch_dvbsubtitle(Context_t* context, int* arg)
{
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;
}
#endif
/* konfetti comment: I dont like the mechanism of overwriting
* 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);
#ifdef MARTII
if (command != CONTAINER_INIT && !avContext)
return cERR_CONTAINER_FFMPEG_ERR;
#endif
switch(command)
{
case CONTAINER_INIT: {
char * FILENAME = (char *)argument;
ret = container_ffmpeg_init(context, FILENAME);
char * filename = (char *)argument;
ret = container_ffmpeg_init(context, filename);
break;
}
case CONTAINER_PLAY: {
@@ -2201,14 +2012,9 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
break;
}
case CONTAINER_SEEK: {
#ifdef MARTII
ret = container_ffmpeg_seek(context, (float)*((float*)argument), 0);
#else
ret = container_ffmpeg_seek(context, (float)*((float*)argument));
#endif
break;
}
#ifdef MARTII
case CONTAINER_SEEK_ABS: {
ret = container_ffmpeg_seek(context, (float)*((float*)argument), -1);
break;
@@ -2240,7 +2046,6 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
*((long long int*)argument) = latestPts;
break;
}
#ifdef MARTII
case CONTAINER_SWITCH_DVBSUBTITLE: {
ret = container_ffmpeg_switch_dvbsubtitle(context, (int*) argument);
break;
@@ -2249,7 +2054,6 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
ret = container_ffmpeg_switch_teletext(context, (int*) argument);
break;
}
#endif
default:
ffmpeg_err("ContainerCmd %d not supported!\n", command);
ret = cERR_CONTAINER_FFMPEG_ERR;
@@ -2261,11 +2065,7 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
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 };
#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 = {
"FFMPEG",

View File

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

View File

@@ -104,12 +104,8 @@ static int hasThreadStarted = 0;
char *SSAgetLine()
{
char *strAux = NULL, *strInput;
#ifdef MARTII
char c[SSA_BUFFER_SIZE];
int ch;
#else
char c[SSA_BUFFER_SIZE], ch;
#endif
int k, tam, tamAux;
k = tamAux = 0;
@@ -162,13 +158,8 @@ char *SSAgetLine()
/* ***************************** */
/* Worker Thread */
/* ***************************** */
#ifdef MARTII
static void* SsaSubtitleThread(void *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);
ssa_printf(10, "\n");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,11 +2,7 @@
#define PLAYBACK_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;
#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 {
char * Name;
@@ -31,12 +27,10 @@ typedef struct PlaybackHandler_s {
unsigned char isVideo;
unsigned char isAudio;
unsigned char isSubtitle;
#ifdef MARTII
unsigned char isDvbSubtitle;
unsigned char isTeletext;
unsigned char mayWriteToFramebuffer;
unsigned char abortRequested;
#endif
int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *);
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)
{
char buf[1024];
#ifdef MARTII
unsigned
#endif
int x,pos=0;
unsigned int x,pos=0;
for(x=0;x<strlen(text);x++){
if(text[x]=='\n'){
buf[pos++]='\\';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -173,9 +173,7 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
break;
}
case MANAGER_LIST: {
#ifdef MARTII
container_ffmpeg_update_tracks(context, context->playback->uri);
#endif
*((char***)argument) = (char **)ManagerList(context);
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));
ret = cERR_LINUXDVB_ERROR;
}
#ifdef MARTII
else linuxdvb_err("V: %llu\n", playInfo.frame_count);
#else
else linuxdvb_err("V: %ull\n", playInfo.frame_count);
#endif
}
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));
ret = cERR_LINUXDVB_ERROR;
}
#ifdef MARTII
else linuxdvb_err("A: %llu\n", playInfo.frame_count);
#else
else linuxdvb_err("A: %ull\n", playInfo.frame_count);
#endif
}
else {
ret = cERR_LINUXDVB_ERROR;

View File

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

View File

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

View File

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

View File

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

View File

@@ -101,19 +101,8 @@ static int reset()
static int writeData(void* _call)
{
#ifndef MARTII
unsigned char r;
unsigned char g;
unsigned char b;
#endif
unsigned char a;
#ifndef MARTII
int x,y;
#endif
int res = 0;
#ifndef MARTII
unsigned char* dst;
#endif
WriterFBCallData_t* call = (WriterFBCallData_t*) _call;
@@ -163,7 +152,7 @@ static int writeData(void* _call)
{
k = ((unsigned)src[x]) * opacity / 255;
ck = 255 - k;
#ifdef MARTII // or __sh__, or !HAVE_TRIPLEDRAGON
#if HAVE_SPARK_HARDWARE
*dst++ = 0;
t = *dst;
*dst++ = (k*r + ck*t) / 255;
@@ -187,9 +176,7 @@ static int writeData(void* _call)
}
} else
{
#ifdef MARTII
int y;
#endif
for (y = 0; y < call->Height; y++)
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
0xFF
};
#ifdef MARTII
// 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
0, 0, //resvd and UPC_EAN_ISRC stuff, unused
0x0A, //private header length

View File

@@ -93,11 +93,7 @@ int InsertPesHeader (unsigned char *data, int size, unsigned char stream_id, uns
#if 0
/* does not seem to hurt, at least with h264 data...? */
if (size > MAX_PES_PACKET_SIZE)
#ifdef MARTII
size = 0; // unbounded
#else
printf("%s: Packet bigger than 63.9K eeeekkkkk\n",__FUNCTION__);
#endif
size = 0; // unbounded
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_len = PacketLength;
size_t l = writev(call->fd, iov, 2);
ssize_t l = writev(call->fd, iov, 2);
if (l < 0) {
len = l;
break;

View File

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