libeplayer3: sync with tdt

This commit is contained in:
martii
2012-07-21 21:03:59 +02:00
parent 94d8b8b57d
commit 60aeebb68e
34 changed files with 300 additions and 344 deletions

View File

@@ -42,7 +42,7 @@ if (debug_level >= level) printf(x); } while (0)
#endif #endif
static const char FILENAME[] = "container.c"; static const char FILENAME[] = __FILE__;
static void printContainerCapabilities() { static void printContainerCapabilities() {
int i, j; int i, j;
@@ -121,5 +121,5 @@ ContainerHandler_t ContainerHandler = {
&SrtContainer, &SrtContainer,
&SsaContainer, &SsaContainer,
&ASSContainer, &ASSContainer,
Command, Command
}; };

View File

@@ -55,17 +55,16 @@
#ifdef ASS_DEBUG #ifdef ASS_DEBUG
static const char *FILENAME = "container_ass.c";
static short debug_level = 10; static short debug_level = 10;
#define ass_printf(level, fmt, x...) do { \ #define ass_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ass_printf(level, fmt, x...) #define ass_printf(level, fmt, x...)
#endif #endif
#ifndef ASS_SILENT #ifndef ASS_SILENT
#define ass_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define ass_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ass_err(fmt, x...) #define ass_err(fmt, x...)
#endif #endif
@@ -179,7 +178,7 @@ void releaseRegions()
{ {
region_t* next, *old; region_t* next, *old;
Writer_t* writer; Writer_t* writer;
if (firstRegion == NULL) if (firstRegion == NULL)
return; return;
@@ -221,12 +220,12 @@ void releaseRegions()
writer->writeData(&out); writer->writeData(&out);
} }
} }
old = next; old = next;
next = next->next; next = next->next;
free(old); free(old);
} }
firstRegion = NULL; firstRegion = NULL;
} }
/* check for regions which should be undisplayed. /* check for regions which should be undisplayed.
@@ -392,7 +391,8 @@ static void ASSThread(Context_t *context) {
// subtitel zeitpunkt zu bestimmen und solange zu schlafen. // subtitel zeitpunkt zu bestimmen und solange zu schlafen.
usleep(1000); usleep(1000);
img = ass_render_frame(ass_renderer, ass_track, playPts / 90.0, &change); if(ass_renderer && ass_track)
img = ass_render_frame(ass_renderer, ass_track, playPts / 90.0, &change);
ass_printf(150, "img %p pts %lu %f\n", img, playPts, playPts / 90.0); ass_printf(150, "img %p pts %lu %f\n", img, playPts, playPts / 90.0);
@@ -425,7 +425,7 @@ static void ASSThread(Context_t *context) {
/* api docu said w and h can be zero which /* api docu said w and h can be zero which
* means image should not be rendered * means image should not be rendered
*/ */
if ((img->w != 0) && (img->h != 0) && (writer)) if ((img->w != 0) && (img->h != 0) && (writer))
{ {
out.fd = framebufferFD; out.fd = framebufferFD;
out.data = img->bitmap; out.data = img->bitmap;
@@ -435,7 +435,7 @@ static void ASSThread(Context_t *context) {
out.x = img->dst_x; out.x = img->dst_x;
out.y = img->dst_y; out.y = img->dst_y;
out.color = img->color; out.color = img->color;
out.Screen_Width = screen_width; out.Screen_Width = screen_width;
out.Screen_Height = screen_height; out.Screen_Height = screen_height;
out.destination = destination; out.destination = destination;
@@ -449,8 +449,8 @@ static void ASSThread(Context_t *context) {
if(context && context->playback && context->playback->isPlaying && writer){ if(context && context->playback && context->playback->isPlaying && writer){
writer->writeData(&out); writer->writeData(&out);
if(threeDMode == 1){ if(threeDMode == 1){
out.x = screen_width/2 + img->dst_x; out.x = screen_width/2 + img->dst_x;
writer->writeData(&out); writer->writeData(&out);
}else if(threeDMode == 2){ }else if(threeDMode == 2){
out.y = screen_height/2 + img->dst_y; out.y = screen_height/2 + img->dst_y;
writer->writeData(&out); writer->writeData(&out);
@@ -465,11 +465,11 @@ static void ASSThread(Context_t *context) {
*/ */
SubtitleOut_t out; SubtitleOut_t out;
out.type = eSub_Gfx; out.type = eSub_Gfx;
if (ass_track->events) if (ass_track->events)
{ {
/* fixme: check values */ /* fixme: check values */
out.pts = ass_track->events->Start * 90.0; out.pts = ass_track->events->Start * 90.0;
out.duration = ass_track->events->Duration / 1000.0; out.duration = ass_track->events->Duration / 1000.0;
} else } else
@@ -522,7 +522,7 @@ int container_ass_init(Context_t *context)
int modefd; int modefd;
char buf[16]; char buf[16];
SubtitleOutputDef_t output; SubtitleOutputDef_t output;
ass_printf(10, ">\n"); ass_printf(10, ">\n");
ass_library = ass_library_init(); ass_library = ass_library_init();
@@ -534,12 +534,12 @@ int container_ass_init(Context_t *context)
if (debug_level >= 100) if (debug_level >= 100)
ass_set_message_cb(ass_library, ass_msg_callback, NULL); ass_set_message_cb(ass_library, ass_msg_callback, NULL);
ass_set_extract_fonts( ass_library, 1 ); ass_set_extract_fonts( ass_library, 1 );
ass_set_style_overrides( ass_library, NULL ); ass_set_style_overrides( ass_library, NULL );
ass_renderer = ass_renderer_init(ass_library); ass_renderer = ass_renderer_init(ass_library);
if (!ass_renderer) { if (!ass_renderer) {
ass_err("ass_renderer_init failed!\n"); ass_err("ass_renderer_init failed!\n");
@@ -556,7 +556,7 @@ int container_ass_init(Context_t *context)
if(modefd > 0){ if(modefd > 0){
read(modefd, buf, 15); read(modefd, buf, 15);
buf[15]='\0'; buf[15]='\0';
close(modefd); close(modefd);
}else threeDMode = 0; }else threeDMode = 0;
if(strncmp(buf,"sbs",3)==0)threeDMode = 1; if(strncmp(buf,"sbs",3)==0)threeDMode = 1;
@@ -637,7 +637,7 @@ int container_ass_process_data(Context_t *context, SubtitleData_t* data)
ass_printf(30,"processing private %d bytes\n",data->extralen); ass_printf(30,"processing private %d bytes\n",data->extralen);
ass_process_codec_private(ass_track, (char*) data->extradata, data->extralen); ass_process_codec_private(ass_track, (char*) data->extradata, data->extralen);
ass_printf(30,"processing private done\n"); ass_printf(30,"processing private done\n");
} }
if (data->data) if (data->data)
{ {
@@ -645,7 +645,7 @@ int container_ass_process_data(Context_t *context, SubtitleData_t* data)
ass_process_data(ass_track, (char*) data->data, data->len); ass_process_data(ass_track, (char*) data->data, data->len);
ass_printf(30,"processing data done\n"); ass_printf(30,"processing data done\n");
} }
return cERR_CONTAINER_ASS_NO_ERROR; return cERR_CONTAINER_ASS_NO_ERROR;
} }
@@ -813,6 +813,5 @@ static char *ASS_Capabilities[] = {"ass", NULL };
Container_t ASSContainer = { Container_t ASSContainer = {
"ASS", "ASS",
&Command, &Command,
ASS_Capabilities, ASS_Capabilities
}; };

View File

@@ -59,13 +59,13 @@
static short debug_level = 10; static short debug_level = 10;
#define ffmpeg_printf(level, fmt, x...) do { \ #define ffmpeg_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ffmpeg_printf(level, fmt, x...) #define ffmpeg_printf(level, fmt, x...)
#endif #endif
#ifndef FFMPEG_SILENT #ifndef FFMPEG_SILENT
#define ffmpeg_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define ffmpeg_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ffmpeg_err(fmt, x...) #define ffmpeg_err(fmt, x...)
#endif #endif
@@ -83,7 +83,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x);
#define cERR_CONTAINER_FFMPEG_ERR -9 #define cERR_CONTAINER_FFMPEG_ERR -9
#define cERR_CONTAINER_FFMPEG_END_OF_FILE -10 #define cERR_CONTAINER_FFMPEG_END_OF_FILE -10
static const char* FILENAME = "container_ffmpeg.c"; static const char* FILENAME = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -171,7 +171,7 @@ static char* Codec2Encoding(enum CodecID id, int* version)
case CODEC_ID_VC1: case CODEC_ID_VC1:
return "V_VC1"; return "V_VC1";
case CODEC_ID_H264: case CODEC_ID_H264:
#ifdef CODEC_ID_FFH264 #if LIBAVCODEC_VERSION_MAJOR < 54
case CODEC_ID_FFH264: case CODEC_ID_FFH264:
#endif #endif
return "V_MPEG4/ISO/AVC"; return "V_MPEG4/ISO/AVC";
@@ -259,13 +259,13 @@ float getDurationFromSSALine(unsigned char* line){
*ptr1 = '\0'; *ptr1 = '\0';
} }
} }
sscanf(ptr[2],"%d:%d:%d.%d",&h,&m,&s,&ms); sscanf(ptr[2],"%d:%d:%d.%d",&h,&m,&s,&ms);
msec = (ms*10) + (s*1000) + (m*60*1000) + (h*24*60*1000); msec = (ms*10) + (s*1000) + (m*60*1000) + (h*24*60*1000);
sscanf(ptr[1],"%d:%d:%d.%d",&h,&m,&s,&ms); sscanf(ptr[1],"%d:%d:%d.%d",&h,&m,&s,&ms);
msec -= (ms*10) + (s*1000) + (m*60*1000) + (h*24*60*1000); msec -= (ms*10) + (s*1000) + (m*60*1000) + (h*24*60*1000);
ffmpeg_printf(10, "%s %s %f\n", ptr[2], ptr[1], (float) msec / 1000.0); ffmpeg_printf(10, "%s %s %f\n", ptr[2], ptr[1], (float) msec / 1000.0);
free(Text); free(Text);
return (float)msec/1000.0; return (float)msec/1000.0;
@@ -274,27 +274,28 @@ float getDurationFromSSALine(unsigned char* line){
/* search for metatdata in context and stream /* search for metatdata in context and stream
* and map it to our metadata. * and map it to our metadata.
*/ */
#if LIBAVFORMAT_VERSION_MAJOR > 53
static char* searchMeta(AVDictionary *metadata, char* ourTag) #if LIBAVCODEC_VERSION_MAJOR < 54
#else
static char* searchMeta(AVMetadata *metadata, char* ourTag) static char* searchMeta(AVMetadata *metadata, char* ourTag)
#else
static char* searchMeta(AVDictionary * metadata, char* ourTag)
#endif #endif
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
AVDictionaryEntry *tag = NULL;
#else
AVMetadataTag *tag = NULL; AVMetadataTag *tag = NULL;
#else
AVDictionaryEntry *tag = NULL;
#endif #endif
int i = 0; int i = 0;
while (metadata_map[i] != NULL) while (metadata_map[i] != NULL)
{ {
if (strcmp(ourTag, metadata_map[i]) == 0) if (strcmp(ourTag, metadata_map[i]) == 0)
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#else
while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
#else
while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#endif #endif
{ {
if (strcmp(tag->key, metadata_map[ i + 1 ]) == 0) if (strcmp(tag->key, metadata_map[ i + 1 ]) == 0)
@@ -305,7 +306,7 @@ static char* searchMeta(AVMetadata *metadata, char* ourTag)
} }
i++; i++;
} }
return NULL; return NULL;
} }
@@ -351,14 +352,14 @@ static void FFMPEGThread(Context_t *context) {
usleep(100000); usleep(100000);
continue; continue;
} }
#define reverse_playback_3 #define reverse_playback_3
#ifdef reverse_playback_3 #ifdef reverse_playback_3
if (context->playback->BackWard && av_gettime() >= showtime) if (context->playback->BackWard && av_gettime() >= showtime)
{ {
audioMute = 1; audioMute = 1;
context->output->Command(context, OUTPUT_CLEAR, "v"); context->output->Command(context, OUTPUT_CLEAR, "v");
if(bofcount == 1) if(bofcount == 1)
{ {
showtime = av_gettime(); showtime = av_gettime();
@@ -406,14 +407,14 @@ if(!context->playback->BackWard && audioMute)
{ {
/* fixme: surplus detection */ /* fixme: surplus detection */
int surplus = 1; int surplus = 1;
ffmpeg_printf(20, "new seek ->c %lld, l %lld, ls %lld, lp %lld\n", currentReadPosition, lastReverseSeek, lastSeek, lastPts); ffmpeg_printf(20, "new seek ->c %lld, l %lld, ls %lld, lp %lld\n", currentReadPosition, lastReverseSeek, lastSeek, lastPts);
context->output->Command(context, OUTPUT_DISCONTINUITY_REVERSE, &surplus); context->output->Command(context, OUTPUT_DISCONTINUITY_REVERSE, &surplus);
/* save the maximum read position, if we reach this, we must /* save the maximum read position, if we reach this, we must
* seek back again. * seek back again.
*/ */
if(lastReverseSeek == 0) if(lastReverseSeek == 0)
lastReverseSeek = currentReadPosition; lastReverseSeek = currentReadPosition;
else else
@@ -427,33 +428,33 @@ if(!context->playback->BackWard && audioMute)
#endif #endif
{ {
ffmpeg_err( "Error seeking\n"); ffmpeg_err( "Error seeking\n");
if (err == cERR_CONTAINER_FFMPEG_END_OF_FILE) if (err == cERR_CONTAINER_FFMPEG_END_OF_FILE)
{ {
break; break;
} }
} }
else else
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
lastSeek = currentReadPosition = avio_tell(avContext->pb);
#else
lastSeek = currentReadPosition = url_ftell(avContext->pb); lastSeek = currentReadPosition = url_ftell(avContext->pb);
#else
lastSeek = currentReadPosition = avio_tell(avContext->pb);
#endif #endif
gotlastPts = 1; gotlastPts = 1;
#ifndef use_sec_to_seek #ifndef use_sec_to_seek
if (err != lastSeek) if (err != lastSeek)
ffmpeg_err("upssssssssssssssss seek not doing what I want\n"); ffmpeg_err("upssssssssssssssss seek not doing what I want\n");
#endif #endif
/* /*
if (currentVideoPts != -1) if (currentVideoPts != -1)
lastPts = currentVideoPts; lastPts = currentVideoPts;
else else
lastPts = currentAudioPts; lastPts = currentAudioPts;
*/ */
} }
} else } else
if (!context->playback->BackWard) if (!context->playback->BackWard)
{ {
@@ -461,7 +462,7 @@ if(!context->playback->BackWard && audioMute)
lastSeek = -1; lastSeek = -1;
lastPts = -1; lastPts = -1;
gotlastPts = 0; gotlastPts = 0;
} }
#endif #endif
getMutex(FILENAME, __FUNCTION__,__LINE__); getMutex(FILENAME, __FUNCTION__,__LINE__);
@@ -480,10 +481,10 @@ if(!context->playback->BackWard && audioMute)
int index = packet.stream_index; int index = packet.stream_index;
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
currentReadPosition = avio_tell(avContext->pb); currentReadPosition = url_ftell(avContext->pb);
#else #else
currentReadPosition = url_ftell(avContext->pb); currentReadPosition = avio_tell(avContext->pb);
#endif #endif
if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0) if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0)
@@ -502,7 +503,7 @@ if(!context->playback->BackWard && audioMute)
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))
latestPts = currentVideoPts; latestPts = currentVideoPts;
#ifdef reverse_playback_2 #ifdef reverse_playback_2
if (currentVideoPts != INVALID_PTS_VALUE && gotlastPts == 1) if (currentVideoPts != INVALID_PTS_VALUE && gotlastPts == 1)
@@ -527,20 +528,20 @@ if(!context->playback->BackWard && audioMute)
if (context->output->video->Write(context, &avOut) < 0) { if (context->output->video->Write(context, &avOut) < 0) {
ffmpeg_err("writing data to video device failed\n"); ffmpeg_err("writing data to video device failed\n");
} }
} }
} }
if (audioTrack != NULL) { if (audioTrack != NULL) {
if (audioTrack->Id == index) { if (audioTrack->Id == index) {
currentAudioPts = audioTrack->pts = pts = calcPts(audioTrack->stream, &packet); currentAudioPts = audioTrack->pts = pts = calcPts(audioTrack->stream, &packet);
if ((currentAudioPts > latestPts) && (!videoTrack)) if ((currentAudioPts > latestPts) && (!videoTrack))
latestPts = currentAudioPts; latestPts = currentAudioPts;
#ifdef reverse_playback_2 #ifdef reverse_playback_2
if (currentAudioPts != INVALID_PTS_VALUE && gotlastPts == 1 && (!videoTrack)) if (currentAudioPts != INVALID_PTS_VALUE && gotlastPts == 1 && (!videoTrack))
{ {
lastPts = currentAudioPts; lastPts = currentAudioPts;
gotlastPts = 0; gotlastPts = 0;
} }
@@ -548,7 +549,7 @@ if(!context->playback->BackWard && audioMute)
ffmpeg_printf(200, "AudioTrack index = %d\n",index); ffmpeg_printf(200, "AudioTrack index = %d\n",index);
if (audioTrack->inject_as_pcm == 1) if (audioTrack->inject_as_pcm == 1)
{ {
int bytesDone = 0; int bytesDone = 0;
unsigned int samples_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; unsigned int samples_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
@@ -563,7 +564,7 @@ if(!context->playback->BackWard && audioMute)
{ {
int decoded_data_size = samples_size; int decoded_data_size = samples_size;
bytesDone = avcodec_decode_audio3(( (AVStream*) audioTrack->stream)->codec, bytesDone = avcodec_decode_audio3(( (AVStream*) audioTrack->stream)->codec,
(short *)(samples), &decoded_data_size, &avpkt); (short *)(samples), &decoded_data_size, &avpkt);
@@ -586,11 +587,7 @@ if(!context->playback->BackWard && audioMute)
avOut.len = decoded_data_size; avOut.len = decoded_data_size;
avOut.pts = pts; avOut.pts = pts;
#if LIBAVFORMAT_VERSION_MAJOR > 53
avOut.extradata = (unsigned char *) &extradata;
#else
avOut.extradata = &extradata; avOut.extradata = &extradata;
#endif
avOut.extralen = sizeof(extradata); avOut.extralen = sizeof(extradata);
avOut.frameRate = 0; avOut.frameRate = 0;
avOut.timeScale = 0; avOut.timeScale = 0;
@@ -601,11 +598,11 @@ if(!context->playback->BackWard && audioMute)
#ifdef reverse_playback_3 #ifdef reverse_playback_3
if (!context->playback->BackWard) if (!context->playback->BackWard)
#endif #endif
if (context->output->audio->Write(context, &avOut) < 0) if (context->output->audio->Write(context, &avOut) < 0)
ffmpeg_err("writing data to audio device failed\n"); ffmpeg_err("writing data to audio device failed\n");
} }
} }
else if (audioTrack->have_aacheader == 1) else if (audioTrack->have_aacheader == 1)
{ {
ffmpeg_printf(200,"write audio aac\n"); ffmpeg_printf(200,"write audio aac\n");
@@ -623,12 +620,12 @@ if(!context->playback->BackWard && audioMute)
#ifdef reverse_playback_3 #ifdef reverse_playback_3
if (!context->playback->BackWard) if (!context->playback->BackWard)
#endif #endif
if (context->output->audio->Write(context, &avOut) < 0) if (context->output->audio->Write(context, &avOut) < 0)
{ {
ffmpeg_err("(aac) writing data to audio device failed\n"); ffmpeg_err("(aac) writing data to audio device failed\n");
} }
} }
else else
{ {
avOut.data = packet.data; avOut.data = packet.data;
@@ -645,7 +642,7 @@ if(!context->playback->BackWard && audioMute)
#ifdef reverse_playback_3 #ifdef reverse_playback_3
if (!context->playback->BackWard) if (!context->playback->BackWard)
#endif #endif
if (context->output->audio->Write(context, &avOut) < 0) if (context->output->audio->Write(context, &avOut) < 0)
{ {
ffmpeg_err("writing data to audio device failed\n"); ffmpeg_err("writing data to audio device failed\n");
} }
@@ -659,14 +656,14 @@ if(!context->playback->BackWard && audioMute)
ffmpeg_printf(100, "subtitleTrack->stream %p \n", subtitleTrack->stream); ffmpeg_printf(100, "subtitleTrack->stream %p \n", subtitleTrack->stream);
pts = calcPts(subtitleTrack->stream, &packet); pts = calcPts(subtitleTrack->stream, &packet);
if ((pts > latestPts) && (!videoTrack) && (!audioTrack)) if ((pts > latestPts) && (!videoTrack) && (!audioTrack))
latestPts = pts; latestPts = pts;
/*Hellmaster1024: in mkv the duration for ID_TEXT is stored in convergence_duration */ /*Hellmaster1024: in mkv the duration for ID_TEXT is stored in convergence_duration */
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 && packet.duration != AV_NOPTS_VALUE )
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 )
@@ -681,7 +678,6 @@ if(!context->playback->BackWard && audioMute)
/* no clue yet */ /* no clue yet */
} }
/* konfetti: I've found cases where the duration from getDurationFromSSALine /* konfetti: I've found cases where the duration from getDurationFromSSALine
* is zero (start end and are really the same in text). I think it make's * is zero (start end and are really the same in text). I think it make's
* no sense to pass those. * no sense to pass those.
@@ -751,11 +747,7 @@ if(!context->playback->BackWard && audioMute)
SubtitleData_t data; SubtitleData_t data;
data.data = line; data.data = line;
data.len = strlen((char*)line); data.len = strlen((char*)line);
#if LIBAVFORMAT_VERSION_MAJOR > 53
data.extradata = (unsigned char *) DEFAULT_ASS_HEAD;
#else
data.extradata = DEFAULT_ASS_HEAD; data.extradata = DEFAULT_ASS_HEAD;
#endif
data.extralen = strlen(DEFAULT_ASS_HEAD); data.extralen = strlen(DEFAULT_ASS_HEAD);
data.pts = pts; data.pts = pts;
data.duration = duration; data.duration = duration;
@@ -827,17 +819,21 @@ int container_ffmpeg_init(Context_t *context, char * filename)
avcodec_register_all(); avcodec_register_all();
av_register_all(); av_register_all();
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
if ((err = avformat_open_input(&avContext, filename, NULL, 0)) != 0) {
#else
if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) { if ((err = av_open_input_file(&avContext, filename, NULL, 0, NULL)) != 0) {
#else
if ((err = avformat_open_input(&avContext, filename, NULL, 0)) != 0) {
#endif #endif
char error[512]; char error[512];
#if LIBAVCODEC_VERSION_MAJOR < 54
ffmpeg_err("av_open_input_file failed %d (%s)\n", err, filename); ffmpeg_err("av_open_input_file failed %d (%s)\n", err, filename);
#else
ffmpeg_err("avformat_open_input failed %d (%s)\n", err, filename);
#endif
av_strerror(err, error, 512); av_strerror(err, error, 512);
ffmpeg_err("Cause: %s\n", error); ffmpeg_err("Cause: %s\n", error);
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_OPEN; return cERR_CONTAINER_FFMPEG_OPEN;
} }
@@ -861,10 +857,10 @@ int container_ffmpeg_init(Context_t *context, char * filename)
ffmpeg_printf(20, "dump format\n"); ffmpeg_printf(20, "dump format\n");
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
av_dump_format(avContext, 0, filename, 0);
#else
dump_format(avContext, 0, filename, 0); dump_format(avContext, 0, filename, 0);
#else
av_dump_format(avContext, 0, filename, 0);
#endif #endif
ffmpeg_printf(1, "number streams %d\n", avContext->nb_streams); ffmpeg_printf(1, "number streams %d\n", avContext->nb_streams);
@@ -883,11 +879,11 @@ int container_ffmpeg_init(Context_t *context, char * filename)
* so set it by default to NULL! * so set it by default to NULL!
*/ */
memset(&track, 0, sizeof(track)); memset(&track, 0, sizeof(track));
switch (stream->codec->codec_type) { switch (stream->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n",stream->codec->codec_type); ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n",stream->codec->codec_type);
if (encoding != NULL) { if (encoding != NULL) {
track.type = eTypeES; track.type = eTypeES;
track.version = version; track.version = version;
@@ -954,7 +950,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n",stream->codec->codec_type); ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n",stream->codec->codec_type);
if (encoding != NULL) { if (encoding != NULL) {
AVDictionaryEntry *lang; AVDictionaryEntry *lang;
track.type = eTypeES; track.type = eTypeES;
@@ -965,7 +961,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
track.Name = strdup(lang->value); track.Name = strdup(lang->value);
else else
track.Name = strdup("und"); track.Name = strdup("und");
ffmpeg_printf(10, "Language %s\n", track.Name); ffmpeg_printf(10, "Language %s\n", track.Name);
track.Encoding = encoding; track.Encoding = encoding;
@@ -997,14 +993,12 @@ int container_ffmpeg_init(Context_t *context, char * filename)
printf("AVCODEC__INIT__SUCCESS\n"); printf("AVCODEC__INIT__SUCCESS\n");
else else
printf("AVCODEC__INIT__FAILED\n"); printf("AVCODEC__INIT__FAILED\n");
} }
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);
Hexdump(stream->codec->extradata, stream->codec->extradata_size); Hexdump(stream->codec->extradata, stream->codec->extradata_size);
/* extradata /* extradata
13 10 56 e5 9d 48 00 (anderen cops) 13 10 56 e5 9d 48 00 (anderen cops)
object_type: 00010 2 = LC object_type: 00010 2 = LC
@@ -1019,7 +1013,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
ps = 0 ps = 0
0000000 0000000
*/ */
unsigned int object_type = 2; // LC unsigned int object_type = 2; // LC
unsigned int sample_index = aac_get_sample_rate_index(stream->codec->sample_rate); unsigned int sample_index = aac_get_sample_rate_index(stream->codec->sample_rate);
unsigned int chan_config = stream->codec->channels; unsigned int chan_config = stream->codec->channels;
@@ -1027,7 +1021,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
object_type = stream->codec->extradata[0] >> 3; object_type = stream->codec->extradata[0] >> 3;
sample_index = ((stream->codec->extradata[0] & 0x7) << 1) sample_index = ((stream->codec->extradata[0] & 0x7) << 1)
+ (stream->codec->extradata[1] >> 7); + (stream->codec->extradata[1] >> 7);
chan_config = (stream->codec->extradata[1] >> 3) && 0xf; chan_config = (stream->codec->extradata[1] >> 3) && 0xf;
} }
ffmpeg_printf(10,"aac object_type %d\n", object_type); ffmpeg_printf(10,"aac object_type %d\n", object_type);
@@ -1045,7 +1039,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
track.aacbuf[4] = 0x00; track.aacbuf[4] = 0x00;
track.aacbuf[5] = 0x1F; track.aacbuf[5] = 0x1F;
track.aacbuf[6] = 0xFC; track.aacbuf[6] = 0xFC;
printf("AAC_HEADER -> "); printf("AAC_HEADER -> ");
Hexdump(track.aacbuf,7); Hexdump(track.aacbuf,7);
track.have_aacheader = 1; track.have_aacheader = 1;
@@ -1067,11 +1061,11 @@ int container_ffmpeg_init(Context_t *context, char * filename)
memcpy(track.aacbuf + 20, &sizehi, 4); // sizehi (not used) memcpy(track.aacbuf + 20, &sizehi, 4); // sizehi (not used)
unsigned char ASF_Audio_Media[16] = unsigned char ASF_Audio_Media[16] =
{0x40,0x9E,0x69,0xF8,0x4D,0x5B,0xCF,0x11,0xA8,0xFD,0x00,0x80,0x5F,0x5C,0x44,0x2B}; {0x40,0x9E,0x69,0xF8,0x4D,0x5B,0xCF,0x11,0xA8,0xFD,0x00,0x80,0x5F,0x5C,0x44,0x2B};
memcpy(track.aacbuf + 24, ASF_Audio_Media, 16); //ASF_Audio_Media memcpy(track.aacbuf + 24, ASF_Audio_Media, 16); //ASF_Audio_Media
unsigned char ASF_Audio_Spread[16] = unsigned char ASF_Audio_Spread[16] =
{0x50,0xCD,0xC3,0xBF,0x8F,0x61,0xCF,0x11,0x8B,0xB2,0x00,0xAA,0x00,0xB4,0xE2,0x20}; {0x50,0xCD,0xC3,0xBF,0x8F,0x61,0xCF,0x11,0x8B,0xB2,0x00,0xAA,0x00,0xB4,0xE2,0x20};
memcpy(track.aacbuf + 40, ASF_Audio_Spread, 16); //ASF_Audio_Spread memcpy(track.aacbuf + 40, ASF_Audio_Spread, 16); //ASF_Audio_Spread
memset(track.aacbuf + 56, 0, 4); // time_offset (not used) memset(track.aacbuf + 56, 0, 4); // time_offset (not used)
@@ -1094,7 +1088,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
#define WMA_VERSION_2_9 0x161 #define WMA_VERSION_2_9 0x161
#define WMA_VERSION_9_PRO 0x162 #define WMA_VERSION_9_PRO 0x162
#define WMA_LOSSLESS 0x163 #define WMA_LOSSLESS 0x163
unsigned short codec_id = 0; unsigned short codec_id = 0;
switch(stream->codec->codec_id) { switch(stream->codec->codec_id) {
//TODO: What code for lossless ? //TODO: What code for lossless ?
case 86056/*CODEC_ID_WMAPRO*/: case 86056/*CODEC_ID_WMAPRO*/:
@@ -1125,7 +1119,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
ffmpeg_printf(1, "block_alignment = %d\n", block_alignment); ffmpeg_printf(1, "block_alignment = %d\n", block_alignment);
memcpy(track.aacbuf + 90, &block_alignment, 2); //block_alignment memcpy(track.aacbuf + 90, &block_alignment, 2); //block_alignment
unsigned short bits_per_sample = unsigned short bits_per_sample =
stream->codec->sample_fmt>=0?(stream->codec->sample_fmt+1)*8:8; stream->codec->sample_fmt>=0?(stream->codec->sample_fmt+1)*8:8;
ffmpeg_printf(1, "bits_per_sample = %d (%d)\n", bits_per_sample, stream->codec->sample_fmt); ffmpeg_printf(1, "bits_per_sample = %d (%d)\n", bits_per_sample, stream->codec->sample_fmt);
memcpy(track.aacbuf + 92, &bits_per_sample, 2); //bits_per_sample memcpy(track.aacbuf + 92, &bits_per_sample, 2); //bits_per_sample
@@ -1150,14 +1144,14 @@ int container_ffmpeg_init(Context_t *context, char * filename)
ffmpeg_err("failed to add track %d\n", n); ffmpeg_err("failed to add track %d\n", n);
} }
} }
} }
else { else {
ffmpeg_err("codec type audio but codec unknown %d\n", stream->codec->codec_id); ffmpeg_err("codec type audio but codec unknown %d\n", stream->codec->codec_id);
} }
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
{ {
AVDictionaryEntry *lang; AVDictionaryEntry *lang;
ffmpeg_printf(10, "CODEC_TYPE_SUBTITLE %d\n",stream->codec->codec_type); ffmpeg_printf(10, "CODEC_TYPE_SUBTITLE %d\n",stream->codec->codec_type);
@@ -1185,7 +1179,7 @@ int container_ffmpeg_init(Context_t *context, char * filename)
track.extraData = stream->codec->extradata; track.extraData = stream->codec->extradata;
track.extraSize = stream->codec->extradata_size; track.extraSize = stream->codec->extradata_size;
ffmpeg_printf(1, "subtitle codec %d\n", stream->codec->codec_id); ffmpeg_printf(1, "subtitle codec %d\n", stream->codec->codec_id);
ffmpeg_printf(1, "subtitle width %d\n", stream->codec->width); ffmpeg_printf(1, "subtitle width %d\n", stream->codec->width);
ffmpeg_printf(1, "subtitle height %d\n", stream->codec->height); ffmpeg_printf(1, "subtitle height %d\n", stream->codec->height);
@@ -1279,7 +1273,7 @@ static int container_ffmpeg_stop(Context_t *context) {
ffmpeg_printf(10, "\n"); ffmpeg_printf(10, "\n");
if (!isContainerRunning) if (!isContainerRunning)
{ {
ffmpeg_err("Container not running\n"); ffmpeg_err("Container not running\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
@@ -1306,7 +1300,7 @@ static int container_ffmpeg_stop(Context_t *context) {
} }
isContainerRunning = 0; isContainerRunning = 0;
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
ffmpeg_printf(10, "ret %d\n", ret); ffmpeg_printf(10, "ret %d\n", ret);
@@ -1315,10 +1309,10 @@ static int container_ffmpeg_stop(Context_t *context) {
static int container_ffmpeg_seek_bytes(off_t pos) { static int container_ffmpeg_seek_bytes(off_t pos) {
int flag = AVSEEK_FLAG_BYTE; int flag = AVSEEK_FLAG_BYTE;
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
off_t current_pos = avio_tell(avContext->pb);
#else
off_t current_pos = url_ftell(avContext->pb); off_t current_pos = url_ftell(avContext->pb);
#else
off_t current_pos = avio_tell(avContext->pb);
#endif #endif
ffmpeg_printf(20, "seeking to position %lld (bytes)\n", pos); ffmpeg_printf(20, "seeking to position %lld (bytes)\n", pos);
@@ -1332,10 +1326,10 @@ static int container_ffmpeg_seek_bytes(off_t pos) {
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
ffmpeg_printf(30, "current_pos after seek %lld\n", avio_tell(avContext->pb));
#else
ffmpeg_printf(30, "current_pos after seek %lld\n", url_ftell(avContext->pb)); ffmpeg_printf(30, "current_pos after seek %lld\n", url_ftell(avContext->pb));
#else
ffmpeg_printf(30, "current_pos after seek %lld\n", avio_tell(avContext->pb));
#endif #endif
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
@@ -1345,12 +1339,12 @@ static int container_ffmpeg_seek_bytes(off_t pos) {
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) {
int flag = AVSEEK_FLAG_BYTE; int flag = AVSEEK_FLAG_BYTE;
off_t newpos; off_t newpos;
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
off_t current_pos = avio_tell(avContext->pb);
#else
off_t current_pos = url_ftell(avContext->pb); off_t current_pos = url_ftell(avContext->pb);
#else
off_t current_pos = avio_tell(avContext->pb);
#endif #endif
if (start == -1) if (start == -1)
start = current_pos; start = current_pos;
@@ -1378,10 +1372,10 @@ static int container_ffmpeg_seek_bytes_rel(off_t start, off_t bytes) {
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
ffmpeg_printf(30, "current_pos after seek %lld\n", avio_tell(avContext->pb));
#else
ffmpeg_printf(30, "current_pos after seek %lld\n", url_ftell(avContext->pb)); ffmpeg_printf(30, "current_pos after seek %lld\n", url_ftell(avContext->pb));
#else
ffmpeg_printf(30, "current_pos after seek %lld\n", avio_tell(avContext->pb));
#endif #endif
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
@@ -1411,10 +1405,10 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
if (pos == -1) if (pos == -1)
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
pos = avio_tell(avContext->pb);
#else
pos = url_ftell(avContext->pb); pos = url_ftell(avContext->pb);
#else
pos = avio_tell(avContext->pb);
#endif #endif
} }
@@ -1427,13 +1421,12 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
getMutex(FILENAME, __FUNCTION__,__LINE__); getMutex(FILENAME, __FUNCTION__,__LINE__);
ffmpeg_printf(10, "iformat->flags %d\n", avContext->iformat->flags); ffmpeg_printf(10, "iformat->flags %d\n", avContext->iformat->flags);
if (avContext->iformat->flags & AVFMT_TS_DISCONT) if (avContext->iformat->flags & AVFMT_TS_DISCONT)
{ {
if (avContext->bit_rate) if (avContext->bit_rate)
{ {
sec *= avContext->bit_rate / 8.0; sec *= avContext->bit_rate / 8.0;
ffmpeg_printf(10, "bit_rate %d\n", avContext->bit_rate); ffmpeg_printf(10, "bit_rate %d\n", avContext->bit_rate);
} }
else else
@@ -1449,7 +1442,7 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_END_OF_FILE; return cERR_CONTAINER_FFMPEG_END_OF_FILE;
} }
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);
if (container_ffmpeg_seek_bytes(pos) < 0) if (container_ffmpeg_seek_bytes(pos) < 0)
@@ -1458,25 +1451,25 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return pos; return pos;
} }
else else
{ {
sec += ((float) pts / 90000.0f); sec += ((float) pts / 90000.0f);
if (sec < 0) if (sec < 0)
sec = 0; sec = 0;
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 , sec * AV_TIME_BASE, flag) < 0) { if (av_seek_frame(avContext, -1 , sec * AV_TIME_BASE, flag) < 0) {
ffmpeg_err( "Error seeking\n"); ffmpeg_err( "Error seeking\n");
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
if (sec <= 0) if (sec <= 0)
{ {
ffmpeg_err("end of file reached\n"); ffmpeg_err("end of file reached\n");
@@ -1499,7 +1492,7 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
ffmpeg_printf(10, "seeking %f sec\n", sec); ffmpeg_printf(10, "seeking %f sec\n", sec);
if (sec == 0.0) if (sec == 0.0)
{ {
ffmpeg_err("sec = 0.0 ignoring\n"); ffmpeg_err("sec = 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
@@ -1507,7 +1500,7 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
ffmpeg_printf(10, "goto %f sec\n", sec); ffmpeg_printf(10, "goto %f sec\n", sec);
if (sec < 0.0) if (sec < 0.0)
{ {
ffmpeg_err("sec < 0.0 ignoring\n"); ffmpeg_err("sec < 0.0 ignoring\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
@@ -1531,7 +1524,7 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
getMutex(FILENAME, __FUNCTION__,__LINE__); getMutex(FILENAME, __FUNCTION__,__LINE__);
ffmpeg_printf(10, "iformat->flags %d\n", avContext->iformat->flags); ffmpeg_printf(10, "iformat->flags %d\n", avContext->iformat->flags);
if (avContext->iformat->flags & AVFMT_TS_DISCONT) if (avContext->iformat->flags & AVFMT_TS_DISCONT)
{ {
/* konfetti: for ts streams seeking frame per seconds does not work (why?). /* konfetti: for ts streams seeking frame per seconds does not work (why?).
@@ -1541,10 +1534,10 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
* about 10 seconds, backward does not work. * about 10 seconds, backward does not work.
*/ */
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
off_t pos = avio_tell(avContext->pb);
#else
off_t pos = url_ftell(avContext->pb); off_t pos = url_ftell(avContext->pb);
#else
off_t pos = avio_tell(avContext->pb);
#endif #endif
ffmpeg_printf(10, "pos %lld %d\n", pos, avContext->bit_rate); ffmpeg_printf(10, "pos %lld %d\n", pos, avContext->bit_rate);
@@ -1552,7 +1545,6 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
if (avContext->bit_rate) if (avContext->bit_rate)
{ {
sec *= avContext->bit_rate / 8.0; sec *= avContext->bit_rate / 8.0;
ffmpeg_printf(10, "bit_rate %d\n", avContext->bit_rate); ffmpeg_printf(10, "bit_rate %d\n", avContext->bit_rate);
} }
else else
@@ -1585,14 +1577,14 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
sec += ((float) current->pts / 90000.0f); 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) {
ffmpeg_err( "Error seeking\n"); ffmpeg_err( "Error seeking\n");
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
} }
releaseMutex(FILENAME, __FUNCTION__,__LINE__); releaseMutex(FILENAME, __FUNCTION__,__LINE__);
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
} }
@@ -1658,19 +1650,19 @@ static int container_ffmpeg_swich_subtitle(Context_t* context, int* arg)
} }
/* 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
* user errors, like it is in the current version (libeplayer2 <-->e2->servicemp3.cpp). * user errors, like it is in the current version (libeplayer2 <-->e2->servicemp3.cpp)
* From e2 there is passed a tag=strdup here and we overwrite this * From e2 there is passed a tag=strdup here and we overwrite this
* strdupped tag. This lead to dangling pointers which are never freed! * strdupped tag. This lead to dangling pointers which are never freed!
* I do not free the string here because this is the wrong way. The mechanism * I do not free the string here because this is the wrong way. The mechanism
* should be changed, or e2 should pass it in a different way... * should be changed, or e2 should pass it in a different way...
*/ */
static int container_ffmpeg_get_info(Context_t* context, char ** infoString) static int container_ffmpeg_get_info(Context_t* context, char ** infoString)
{ {
Track_t * videoTrack = NULL; Track_t * videoTrack = NULL;
Track_t * audioTrack = NULL; Track_t * audioTrack = NULL;
char* meta = NULL; char* meta = NULL;
ffmpeg_printf(20, ">\n"); ffmpeg_printf(20, ">\n");
if (avContext != NULL) if (avContext != NULL)
@@ -1680,25 +1672,25 @@ static int container_ffmpeg_get_info(Context_t* context, char ** infoString)
ffmpeg_err("infostring NULL\n"); ffmpeg_err("infostring NULL\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
ffmpeg_printf(20, "%s\n", *infoString); ffmpeg_printf(20, "%s\n", *infoString);
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);
if ((meta = searchMeta(avContext->metadata, *infoString)) == NULL) if ((meta = searchMeta(avContext->metadata, *infoString)) == NULL)
{ {
if (audioTrack != NULL) if (audioTrack != NULL)
{ {
AVStream* stream = audioTrack->stream; AVStream* stream = audioTrack->stream;
meta = searchMeta(stream->metadata, *infoString); meta = searchMeta(stream->metadata, *infoString);
} }
if ((meta == NULL) && (videoTrack != NULL)) if ((meta == NULL) && (videoTrack != NULL))
{ {
AVStream* stream = videoTrack->stream; AVStream* stream = videoTrack->stream;
meta = searchMeta(stream->metadata, *infoString); meta = searchMeta(stream->metadata, *infoString);
} }
} }
@@ -1717,8 +1709,8 @@ static int container_ffmpeg_get_info(Context_t* context, char ** infoString)
ffmpeg_err("avContext NULL\n"); ffmpeg_err("avContext NULL\n");
return cERR_CONTAINER_FFMPEG_ERR; return cERR_CONTAINER_FFMPEG_ERR;
} }
return cERR_CONTAINER_FFMPEG_NO_ERROR; return cERR_CONTAINER_FFMPEG_NO_ERROR;
} }
@@ -1791,6 +1783,5 @@ static char *FFMPEG_Capabilities[] = {"avi", "mkv", "mp4", "ts", "mov", "flv", "
Container_t FFMPEGContainer = { Container_t FFMPEGContainer = {
"FFMPEG", "FFMPEG",
&Command, &Command,
FFMPEG_Capabilities, FFMPEG_Capabilities
}; };

View File

@@ -50,13 +50,13 @@
static short debug_level = 10; static short debug_level = 10;
#define srt_printf(level, fmt, x...) do { \ #define srt_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define srt_printf(level, fmt, x...) #define srt_printf(level, fmt, x...)
#endif #endif
#ifndef SRT_SILENT #ifndef SRT_SILENT
#define srt_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define srt_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define srt_err(fmt, x...) #define srt_err(fmt, x...)
#endif #endif
@@ -68,7 +68,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x);
#define TRACKWRAP 20 #define TRACKWRAP 20
#define MAXLINELENGTH 80 #define MAXLINELENGTH 80
static const char FILENAME[] = "text_srt.c"; static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -138,7 +138,7 @@ static void* SrtSubtitleThread(void *data) {
unsigned long long int Pts = 0; unsigned long long int Pts = 0;
double Duration = 0; double Duration = 0;
char * Text = NULL; char * Text = NULL;
Context_t *context = (Context_t*) data; Context_t *context = (Context_t*) data;
srt_printf(10, "\n"); srt_printf(10, "\n");
@@ -146,12 +146,12 @@ static void* SrtSubtitleThread(void *data) {
while(context && context->playback && context->playback->isPlaying && fsub && fgets(Data, MAXLINELENGTH, fsub)) { while(context && context->playback && context->playback->isPlaying && fsub && fgets(Data, MAXLINELENGTH, fsub)) {
srt_printf(20, "pos=%d\n", pos); srt_printf(20, "pos=%d\n", pos);
if(pos == 0) if(pos == 0)
{ {
if(Data[0] == '\n' || Data[0] == '\0' || Data[0] == 13 /* ^M */) if(Data[0] == '\n' || Data[0] == '\0' || Data[0] == 13 /* ^M */)
continue; /* Empty line not allowed here */ continue; /* Empty line not allowed here */
pos++; pos++;
} else if(pos == 1) } else if(pos == 1)
{ {
int ret, horIni, minIni, secIni, milIni, horFim, minFim, secFim, milFim; int ret, horIni, minIni, secIni, milIni, horFim, minFim, secFim, milFim;
@@ -285,19 +285,19 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
srt_err("Filename NULL\n"); srt_err("Filename NULL\n");
return cERR_SRT_ERROR; return cERR_SRT_ERROR;
} }
srt_printf(10, "file: %s\n", Filename); srt_printf(10, "file: %s\n", Filename);
copyFilename = strdup(Filename); copyFilename = strdup(Filename);
FilenameFolder = dirname(copyFilename); FilenameFolder = dirname(copyFilename);
if (FilenameFolder == NULL) if (FilenameFolder == NULL)
{ {
srt_err("FilenameFolder NULL\n"); srt_err("FilenameFolder NULL\n");
return cERR_SRT_ERROR; return cERR_SRT_ERROR;
} }
srt_printf(10, "folder: %s\n", FilenameFolder); srt_printf(10, "folder: %s\n", FilenameFolder);
getExtension(copyFilename, &FilenameExtension); getExtension(copyFilename, &FilenameExtension);
@@ -312,10 +312,10 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
srt_printf(10, "ext: %s\n", FilenameExtension); srt_printf(10, "ext: %s\n", FilenameExtension);
FilenameShort = basename(copyFilename); FilenameShort = basename(copyFilename);
/* cut extension */ /* cut extension */
FilenameShort[strlen(FilenameShort) - strlen(FilenameExtension) - 1] = '\0'; FilenameShort[strlen(FilenameShort) - strlen(FilenameExtension) - 1] = '\0';
srt_printf(10, "basename: %s\n", FilenameShort); srt_printf(10, "basename: %s\n", FilenameShort);
srt_printf(10, "%s\n%s | %s | %s\n", copyFilename, FilenameFolder, FilenameShort, FilenameExtension); srt_printf(10, "%s\n%s | %s | %s\n", copyFilename, FilenameFolder, FilenameShort, FilenameExtension);
@@ -349,9 +349,9 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
{ {
char absSubtitleFileName[PATH_MAX]; char absSubtitleFileName[PATH_MAX];
/* found something of interest, so now make an absolut path name */ /* found something of interest, so now make an absolut path name */
sprintf(absSubtitleFileName, "%s/%s.%s", FilenameFolder, subtitleFilename, subtitleExtension); sprintf(absSubtitleFileName, "%s/%s.%s", FilenameFolder, subtitleFilename, subtitleExtension);
srt_printf(10, "SRT: %s [%s]\n", subtitleExtension, subtitleFilename); srt_printf(10, "SRT: %s [%s]\n", subtitleExtension, subtitleFilename);
srt_printf(10, "\t->%s\n", absSubtitleFileName); srt_printf(10, "\t->%s\n", absSubtitleFileName);
@@ -359,7 +359,7 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
absSubtitleFileName, absSubtitleFileName,
i, i,
}; };
SrtManagerAdd(context, SrtSubtitle); SrtManagerAdd(context, SrtSubtitle);
Track_t Subtitle = { Track_t Subtitle = {
@@ -423,7 +423,7 @@ static int SrtCloseSubtitle(Context_t *context) {
static int SrtSwitchSubtitle(Context_t *context, int* arg) { static int SrtSwitchSubtitle(Context_t *context, int* arg) {
int ret = cERR_SRT_NO_ERROR; int ret = cERR_SRT_NO_ERROR;
srt_printf(10, "arg:%d\n", *arg); srt_printf(10, "arg:%d\n", *arg);
ret = SrtCloseSubtitle(context); ret = SrtCloseSubtitle(context);
@@ -442,7 +442,7 @@ static int SrtSwitchSubtitle(Context_t *context, int* arg) {
static int SrtDel(Context_t *context) { static int SrtDel(Context_t *context) {
int ret = cERR_SRT_NO_ERROR; int ret = cERR_SRT_NO_ERROR;
srt_printf(10, "\n"); srt_printf(10, "\n");
ret = SrtCloseSubtitle(context); ret = SrtCloseSubtitle(context);
@@ -454,7 +454,7 @@ static int SrtDel(Context_t *context) {
static int Command(void *_context, ContainerCmd_t command, void * argument) { static int Command(void *_context, ContainerCmd_t command, void * argument) {
Context_t *context = (Context_t*) _context; Context_t *context = (Context_t*) _context;
int ret = cERR_SRT_NO_ERROR; int ret = cERR_SRT_NO_ERROR;
srt_printf(10, "\n"); srt_printf(10, "\n");
switch(command) { switch(command) {
@@ -486,5 +486,5 @@ static char *SrtCapabilities[] = { "srt", NULL };
Container_t SrtContainer = { Container_t SrtContainer = {
"SRT", "SRT",
&Command, &Command,
SrtCapabilities, SrtCapabilities
}; };

View File

@@ -50,13 +50,13 @@
static short debug_level = 10; static short debug_level = 10;
#define ssa_printf(level, fmt, x...) do { \ #define ssa_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ssa_printf(level, fmt, x...) #define ssa_printf(level, fmt, x...)
#endif #endif
#ifndef SSA_SILENT #ifndef SSA_SILENT
#define ssa_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define ssa_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ssa_err(fmt, x...) #define ssa_err(fmt, x...)
#endif #endif
@@ -71,7 +71,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x);
//Buffer size used in getLine function. Do not set to value less than 1 !!! //Buffer size used in getLine function. Do not set to value less than 1 !!!
#define SSA_BUFFER_SIZE 14 #define SSA_BUFFER_SIZE 14
static const char FILENAME[] = "text_ssa.c"; static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -141,7 +141,7 @@ char *SSAgetLine()
strInput[k] = '\0'; strInput[k] = '\0';
} }
else { else {
tamAux = 1; tamAux = 1;
fclose(fssa); fclose(fssa);
fssa = NULL; fssa = NULL;
@@ -168,7 +168,7 @@ static void* SsaSubtitleThread(void *data) {
while ( context && context->playback && context->playback->isPlaying && fssa ) { while ( context && context->playback && context->playback->isPlaying && fssa ) {
char *line = NULL; char *line = NULL;
do do
{ {
line = SSAgetLine(); line = SSAgetLine();
if(strncmp(line,"Dialogue: ",10)) { if(strncmp(line,"Dialogue: ",10)) {
@@ -186,7 +186,7 @@ static void* SsaSubtitleThread(void *data) {
context->playback && context->playback &&
context->playback->isPlaying) { context->playback->isPlaying) {
SubtitleData_t data; SubtitleData_t data;
data.data = (unsigned char*) line; data.data = (unsigned char*) line;
data.len = strlen(line); data.len = strlen(line);
data.extradata = (unsigned char*) head; data.extradata = (unsigned char*) head;
@@ -201,7 +201,7 @@ static void* SsaSubtitleThread(void *data) {
} }
hasThreadStarted = 0; hasThreadStarted = 0;
if(head) { if(head) {
free(head); free(head);
head = NULL; head = NULL;
@@ -260,7 +260,7 @@ static void SsaManagerDel(Context_t * context) {
for (i = 0; i < TrackCount; i++) { for (i = 0; i < TrackCount; i++) {
if (Tracks[i].File != NULL) if (Tracks[i].File != NULL)
free(Tracks[i].File); free(Tracks[i].File);
Tracks[i].File = NULL; Tracks[i].File = NULL;
} }
free(Tracks); free(Tracks);
@@ -286,19 +286,19 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) {
ssa_err("Filename NULL\n"); ssa_err("Filename NULL\n");
return cERR_SSA_ERROR; return cERR_SSA_ERROR;
} }
ssa_printf(10, "file: %s\n", Filename); ssa_printf(10, "file: %s\n", Filename);
copyFilename = strdup(Filename); copyFilename = strdup(Filename);
FilenameFolder = dirname(copyFilename); FilenameFolder = dirname(copyFilename);
if (FilenameFolder == NULL) if (FilenameFolder == NULL)
{ {
ssa_err("FilenameFolder NULL\n"); ssa_err("FilenameFolder NULL\n");
return cERR_SSA_ERROR; return cERR_SSA_ERROR;
} }
ssa_printf(10, "folder: %s\n", FilenameFolder); ssa_printf(10, "folder: %s\n", FilenameFolder);
getExtension(copyFilename, &FilenameExtension); getExtension(copyFilename, &FilenameExtension);
@@ -350,9 +350,9 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) {
{ {
char absSubtitleFileName[PATH_MAX]; char absSubtitleFileName[PATH_MAX];
/* found something of interest, so now make an absolut path name */ /* found something of interest, so now make an absolut path name */
sprintf(absSubtitleFileName, "%s/%s.%s", FilenameFolder, subtitleFilename, subtitleExtension); sprintf(absSubtitleFileName, "%s/%s.%s", FilenameFolder, subtitleFilename, subtitleExtension);
ssa_printf(10, "SSA: %s [%s]\n", subtitleExtension, subtitleFilename); ssa_printf(10, "SSA: %s [%s]\n", subtitleExtension, subtitleFilename);
ssa_printf(10, "\t->%s\n", absSubtitleFileName); ssa_printf(10, "\t->%s\n", absSubtitleFileName);
@@ -360,7 +360,7 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) {
absSubtitleFileName, absSubtitleFileName,
i, i,
}; };
SsaManagerAdd(context, SsaSubtitle); SsaManagerAdd(context, SsaSubtitle);
Track_t Subtitle = { Track_t Subtitle = {
@@ -415,7 +415,7 @@ static int SsaCloseSubtitle(Context_t *context) {
/* this closes the thread! */ /* this closes the thread! */
fssa = NULL; fssa = NULL;
hasThreadStarted = 0; hasThreadStarted = 0;
return cERR_SSA_NO_ERROR; return cERR_SSA_NO_ERROR;
@@ -423,7 +423,7 @@ static int SsaCloseSubtitle(Context_t *context) {
static int SsaSwitchSubtitle(Context_t *context, int* arg) { static int SsaSwitchSubtitle(Context_t *context, int* arg) {
int ret = cERR_SSA_NO_ERROR; int ret = cERR_SSA_NO_ERROR;
ssa_printf(10, "\n"); ssa_printf(10, "\n");
ret = SsaCloseSubtitle(context); ret = SsaCloseSubtitle(context);
@@ -434,7 +434,7 @@ static int SsaSwitchSubtitle(Context_t *context, int* arg) {
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create (&thread_sub, &attr, &SsaSubtitleThread, context); pthread_create (&thread_sub, &attr, &SsaSubtitleThread, context);
hasThreadStarted = 1; hasThreadStarted = 1;
} }
@@ -443,11 +443,11 @@ static int SsaSwitchSubtitle(Context_t *context, int* arg) {
static int SsaDel(Context_t *context) { static int SsaDel(Context_t *context) {
int ret = cERR_SSA_NO_ERROR; int ret = cERR_SSA_NO_ERROR;
ssa_printf(10, "\n"); ssa_printf(10, "\n");
ret = SsaCloseSubtitle(context); ret = SsaCloseSubtitle(context);
SsaManagerDel(context); SsaManagerDel(context);
return ret; return ret;
@@ -456,7 +456,7 @@ static int SsaDel(Context_t *context) {
static int Command(void *_context, ContainerCmd_t command, void * argument) { static int Command(void *_context, ContainerCmd_t command, void * argument) {
Context_t *context = (Context_t*) _context; Context_t *context = (Context_t*) _context;
int ret = cERR_SSA_NO_ERROR; int ret = cERR_SSA_NO_ERROR;
ssa_printf(10, "\n"); ssa_printf(10, "\n");
switch(command) { switch(command) {
@@ -488,5 +488,5 @@ static char *SsaCapabilities[] = { "ssa", NULL };
Container_t SsaContainer = { Container_t SsaContainer = {
"SSA", "SSA",
&Command, &Command,
SsaCapabilities, SsaCapabilities
}; };

View File

@@ -29,7 +29,7 @@ typedef enum {
OUTPUT_SUBTITLE_REGISTER_FUNCTION = 222, OUTPUT_SUBTITLE_REGISTER_FUNCTION = 222,
OUTPUT_SUBTITLE_REGISTER_BUFFER = 223, OUTPUT_SUBTITLE_REGISTER_BUFFER = 223,
OUTPUT_GET_SUBTITLE_OUTPUT, OUTPUT_GET_SUBTITLE_OUTPUT,
OUTPUT_SET_SUBTITLE_OUTPUT, OUTPUT_SET_SUBTITLE_OUTPUT
} OutputCmd_t; } OutputCmd_t;
typedef struct typedef struct

View File

@@ -58,7 +58,7 @@ typedef enum {
STREAM_TYPE_H264, /* Deprecated */ STREAM_TYPE_H264, /* Deprecated */
STREAM_TYPE_ASF, /* Needs work so it can be deprecated */ STREAM_TYPE_ASF, /* Needs work so it can be deprecated */
STREAM_TYPE_MP4, /* Deprecated */ STREAM_TYPE_MP4, /* Deprecated */
STREAM_TYPE_RAW, /* Deprecated */ STREAM_TYPE_RAW /* Deprecated */
} stream_type_t; } stream_type_t;
/* /*
@@ -322,4 +322,3 @@ typedef dvb_option_t video_option_t;
#define AUDIO_GET_PLAY_INFO _IOR('o', 78, audio_play_info_t) #define AUDIO_GET_PLAY_INFO _IOR('o', 78, audio_play_info_t)
#endif /* H_DVB_STM_H */ #endif /* H_DVB_STM_H */

View File

@@ -57,7 +57,7 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_AUDIO_MGR_NO_ERROR 0 #define cERR_AUDIO_MGR_NO_ERROR 0
#define cERR_AUDIO_MGR_ERROR -1 #define cERR_AUDIO_MGR_ERROR -1
static const char FILENAME[] = "audio.c"; static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -258,6 +258,5 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
struct Manager_s AudioManager = { struct Manager_s AudioManager = {
"Audio", "Audio",
&Command, &Command,
NULL, NULL
}; };

View File

@@ -45,7 +45,7 @@ ManagerHandler_t ManagerHandler = {
"ManagerHandler", "ManagerHandler",
&AudioManager, &AudioManager,
&VideoManager, &VideoManager,
&SubtitleManager, &SubtitleManager
}; };
/* ***************************** */ /* ***************************** */
@@ -90,4 +90,3 @@ void freeTrack(Track_t* track)
free(track->aacbuf); free(track->aacbuf);
} }

View File

@@ -54,7 +54,7 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_SUBTITLE_MGR_NO_ERROR 0 #define cERR_SUBTITLE_MGR_NO_ERROR 0
#define cERR_SUBTITLE_MGR_ERROR -1 #define cERR_SUBTITLE_MGR_ERROR -1
static const char FILENAME[] = "subtitle.c"; static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -248,6 +248,5 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
struct Manager_s SubtitleManager = { struct Manager_s SubtitleManager = {
"Subtitle", "Subtitle",
&Command, &Command,
NULL, NULL
}; };

View File

@@ -54,7 +54,7 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_VIDEO_MGR_NO_ERROR 0 #define cERR_VIDEO_MGR_NO_ERROR 0
#define cERR_VIDEO_MGR_ERROR -1 #define cERR_VIDEO_MGR_ERROR -1
static const char FILENAME[] = "video.c"; static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -237,6 +237,5 @@ static int Command(void *_context, ManagerCmd_t command, void * argument) {
struct Manager_s VideoManager = { struct Manager_s VideoManager = {
"Video", "Video",
&Command, &Command,
NULL, NULL
}; };

View File

@@ -51,17 +51,17 @@
static short debug_level = 10; static short debug_level = 10;
static const char FILENAME[] = "linuxdvb.c"; static const char FILENAME[] = __FILE__;
#ifdef LINUXDVB_DEBUG #ifdef LINUXDVB_DEBUG
#define linuxdvb_printf(level, fmt, x...) do { \ #define linuxdvb_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x ); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x ); } while (0)
#else #else
#define linuxdvb_printf(x...) #define linuxdvb_printf(x...)
#endif #endif
#ifndef LINUXDVB_SILENT #ifndef LINUXDVB_SILENT
#define linuxdvb_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define linuxdvb_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define linuxdvb_err(x...) #define linuxdvb_err(x...)
#endif #endif
@@ -601,8 +601,8 @@ int LinuxDvbFastForward(Context_t *context, char * type) {
int LinuxDvbReverse(Context_t *context, char * type) { int LinuxDvbReverse(Context_t *context, char * type) {
#ifdef reverse_playback_2
int ret = cERR_LINUXDVB_NO_ERROR; int ret = cERR_LINUXDVB_NO_ERROR;
#ifdef reverse_playback_2
int speed; int speed;
unsigned char video = !strcmp("video", type); unsigned char video = !strcmp("video", type);
@@ -654,8 +654,8 @@ int LinuxDvbReverse(Context_t *context, char * type) {
linuxdvb_printf(10, "exiting with value %d\n", ret); linuxdvb_printf(10, "exiting with value %d\n", ret);
return ret;
#endif #endif
return ret;
} }
int LinuxDvbSlowMotion(Context_t *context, char * type) { int LinuxDvbSlowMotion(Context_t *context, char * type) {
@@ -1204,7 +1204,5 @@ struct Output_s LinuxDvbOutput = {
"LinuxDvb", "LinuxDvb",
&Command, &Command,
&Write, &Write,
LinuxDvbCapabilities, LinuxDvbCapabilities
}; };

View File

@@ -53,7 +53,7 @@ if (debug_level >= level) printf(x); } while (0)
#define cERR_OUTPUT_NO_ERROR 0 #define cERR_OUTPUT_NO_ERROR 0
#define cERR_OUTPUT_INTERNAL_ERROR -1 #define cERR_OUTPUT_INTERNAL_ERROR -1
static const char* FILENAME = "output.c"; static const char* FILENAME = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -349,5 +349,5 @@ OutputHandler_t OutputHandler = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
&Command, &Command
}; };

View File

@@ -49,13 +49,13 @@
static short debug_level = 10; static short debug_level = 10;
#define subtitle_printf(level, fmt, x...) do { \ #define subtitle_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define subtitle_printf(level, fmt, x...) #define subtitle_printf(level, fmt, x...)
#endif #endif
#ifndef SUBTITLE_SILENT #ifndef SUBTITLE_SILENT
#define subtitle_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define subtitle_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define subtitle_err(fmt, x...) #define subtitle_err(fmt, x...)
#endif #endif
@@ -64,7 +64,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x);
#define cERR_SUBTITLE_NO_ERROR 0 #define cERR_SUBTITLE_NO_ERROR 0
#define cERR_SUBTITLE_ERROR -1 #define cERR_SUBTITLE_ERROR -1
static const char FILENAME[] = "output_subtitle.c"; static const char FILENAME[] = "subtitle.c";
/* /*
Number, Style, Name,, MarginL, MarginR, MarginV, Effect,, Text Number, Style, Name,, MarginL, MarginR, MarginV, Effect,, Text
@@ -839,7 +839,5 @@ struct Output_s SubtitleOutput = {
"Subtitle", "Subtitle",
&Command, &Command,
&Write, &Write,
SubtitleCapabilitis, SubtitleCapabilitis
}; };

View File

@@ -57,16 +57,15 @@
#ifdef AAC_DEBUG #ifdef AAC_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "aac.c";
#define aac_printf(level, fmt, x...) do { \ #define aac_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define aac_printf(level, fmt, x...) #define aac_printf(level, fmt, x...)
#endif #endif
#ifndef AAC_SILENT #ifndef AAC_SILENT
#define aac_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define aac_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define aac_err(fmt, x...) #define aac_err(fmt, x...)
#endif #endif

View File

@@ -56,16 +56,15 @@
#ifdef AC3_DEBUG #ifdef AC3_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "ac3.c";
#define ac3_printf(level, fmt, x...) do { \ #define ac3_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ac3_printf(level, fmt, x...) #define ac3_printf(level, fmt, x...)
#endif #endif
#ifndef AC3_SILENT #ifndef AC3_SILENT
#define ac3_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define ac3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define ac3_err(fmt, x...) #define ac3_err(fmt, x...)
#endif #endif
@@ -140,13 +139,12 @@ static WriterCaps_t caps_ac3 = {
"ac3", "ac3",
eAudio, eAudio,
"A_AC3", "A_AC3",
AUDIO_ENCODING_AC3, AUDIO_ENCODING_AC3
}; };
struct Writer_s WriterAudioAC3 = { struct Writer_s WriterAudioAC3 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_ac3, &caps_ac3
}; };

View File

@@ -55,16 +55,15 @@
#ifdef DIVX_DEBUG #ifdef DIVX_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "divx.c";
#define divx_printf(level, fmt, x...) do { \ #define divx_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define divx_printf(level, fmt, x...) #define divx_printf(level, fmt, x...)
#endif #endif
#ifndef DIVX_SILENT #ifndef DIVX_SILENT
#define divx_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define divx_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define divx_err(fmt, x...) #define divx_err(fmt, x...)
#endif #endif
@@ -177,40 +176,40 @@ static WriterCaps_t mpeg4p2_caps = {
"mscomp", "mscomp",
eVideo, eVideo,
"V_MSCOMP", "V_MSCOMP",
VIDEO_ENCODING_MPEG4P2, VIDEO_ENCODING_MPEG4P2
}; };
struct Writer_s WriterVideoMSCOMP = { struct Writer_s WriterVideoMSCOMP = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&mpeg4p2_caps, &mpeg4p2_caps
}; };
static WriterCaps_t fourcc_caps = { static WriterCaps_t fourcc_caps = {
"fourcc", "fourcc",
eVideo, eVideo,
"V_MS/VFW/FOURCC", "V_MS/VFW/FOURCC",
VIDEO_ENCODING_MPEG4P2, VIDEO_ENCODING_MPEG4P2
}; };
struct Writer_s WriterVideoFOURCC = { struct Writer_s WriterVideoFOURCC = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&fourcc_caps, &fourcc_caps
}; };
static WriterCaps_t divx_caps = { static WriterCaps_t divx_caps = {
"divx", "divx",
eVideo, eVideo,
"V_MKV/XVID", "V_MKV/XVID",
VIDEO_ENCODING_MPEG4P2, VIDEO_ENCODING_MPEG4P2
}; };
struct Writer_s WriterVideoDIVX = { struct Writer_s WriterVideoDIVX = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&divx_caps, &divx_caps
}; };

View File

@@ -59,16 +59,15 @@
#ifdef DTS_DEBUG #ifdef DTS_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "dts.c";
#define dts_printf(level, fmt, x...) do { \ #define dts_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define dts_printf(level, fmt, x...) #define dts_printf(level, fmt, x...)
#endif #endif
#ifndef DTS_SILENT #ifndef DTS_SILENT
#define dts_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define dts_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define dts_err(fmt, x...) #define dts_err(fmt, x...)
#endif #endif
@@ -158,12 +157,12 @@ static WriterCaps_t caps = {
"dts", "dts",
eAudio, eAudio,
"A_DTS", "A_DTS",
AUDIO_ENCODING_DTS, AUDIO_ENCODING_DTS
}; };
struct Writer_s WriterAudioDTS = { struct Writer_s WriterAudioDTS = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps, &caps
}; };

View File

@@ -54,16 +54,15 @@
#ifdef FLAC_DEBUG #ifdef FLAC_DEBUG
static short debug_level = 1; static short debug_level = 1;
static const char *FILENAME = "flac.c";
#define flac_printf(level, fmt, x...) do { \ #define flac_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define flac_printf(level, fmt, x...) #define flac_printf(level, fmt, x...)
#endif #endif
#ifndef FLAC_SILENT #ifndef FLAC_SILENT
#define flac_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define flac_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define flac_err(fmt, x...) #define flac_err(fmt, x...)
#endif #endif
@@ -140,13 +139,12 @@ static WriterCaps_t caps_flac = {
"flac", "flac",
eAudio, eAudio,
"A_FLAC", "A_FLAC",
AUDIO_ENCODING_LPCM, //AUDIO_ENCODING_FLAC, AUDIO_ENCODING_LPCM //AUDIO_ENCODING_FLAC
}; };
struct Writer_s WriterAudioFLAC = { struct Writer_s WriterAudioFLAC = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_flac, &caps_flac
}; };

View File

@@ -54,16 +54,15 @@
#ifdef FB_DEBUG #ifdef FB_DEBUG
static short debug_level = 10; static short debug_level = 10;
static const char *FILENAME = "framebuffer.c";
#define fb_printf(level, fmt, x...) do { \ #define fb_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define fb_printf(level, fmt, x...) #define fb_printf(level, fmt, x...)
#endif #endif
#ifndef FB_SILENT #ifndef FB_SILENT
#define fb_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define fb_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define fb_err(fmt, x...) #define fb_err(fmt, x...)
#endif #endif
@@ -186,12 +185,12 @@ static WriterCaps_t caps = {
"framebuffer", "framebuffer",
eGfx, eGfx,
"framebuffer", "framebuffer",
0, 0
}; };
struct Writer_s WriterFramebuffer = { struct Writer_s WriterFramebuffer = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps, &caps
}; };

View File

@@ -54,16 +54,15 @@
#ifdef H263_DEBUG #ifdef H263_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "h263.c";
#define h263_printf(level, fmt, x...) do { \ #define h263_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define h263_printf(level, fmt, x...) #define h263_printf(level, fmt, x...)
#endif #endif
#ifndef H263_SILENT #ifndef H263_SILENT
#define h263_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define h263_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define h263_err(fmt, x...) #define h263_err(fmt, x...)
#endif #endif
@@ -152,26 +151,26 @@ static WriterCaps_t caps_h263 = {
"h263", "h263",
eVideo, eVideo,
"V_H263", "V_H263",
VIDEO_ENCODING_H263, VIDEO_ENCODING_H263
}; };
struct Writer_s WriterVideoH263 = { struct Writer_s WriterVideoH263 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_h263, &caps_h263
}; };
static WriterCaps_t caps_flv = { static WriterCaps_t caps_flv = {
"FLV", "FLV",
eVideo, eVideo,
"V_FLV", "V_FLV",
VIDEO_ENCODING_FLV1, VIDEO_ENCODING_FLV1
}; };
struct Writer_s WriterVideoFLV = { struct Writer_s WriterVideoFLV = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_flv, &caps_flv
}; };

View File

@@ -53,17 +53,16 @@
#ifdef H264_DEBUG #ifdef H264_DEBUG
static const char *FILENAME = "h264.c";
static short debug_level = 0; static short debug_level = 0;
#define h264_printf(level, fmt, x...) do { \ #define h264_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define h264_printf(level, fmt, x...) #define h264_printf(level, fmt, x...)
#endif #endif
#ifndef H264_SILENT #ifndef H264_SILENT
#define h264_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define h264_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define h264_err(fmt, x...) #define h264_err(fmt, x...)
#endif #endif
@@ -428,13 +427,12 @@ static WriterCaps_t caps = {
"h264", "h264",
eVideo, eVideo,
"V_MPEG4/ISO/AVC", "V_MPEG4/ISO/AVC",
VIDEO_ENCODING_H264, VIDEO_ENCODING_H264
}; };
struct Writer_s WriterVideoH264 = { struct Writer_s WriterVideoH264 = {
&reset, &reset,
&writeData, &writeData,
&writeReverseData, &writeReverseData,
&caps, &caps
}; };

View File

@@ -123,4 +123,3 @@ void FlushBits(BitPacker_t * ld)
ld->Remaining = 32; ld->Remaining = 32;
ld->BitBuffer = 0; ld->BitBuffer = 0;
} }

View File

@@ -54,16 +54,15 @@
#ifdef MP3_DEBUG #ifdef MP3_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "mp3.c";
#define mp3_printf(level, fmt, x...) do { \ #define mp3_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define mp3_printf(level, fmt, x...) #define mp3_printf(level, fmt, x...)
#endif #endif
#ifndef MP3_SILENT #ifndef MP3_SILENT
#define mp3_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define mp3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define mp3_err(fmt, x...) #define mp3_err(fmt, x...)
#endif #endif
@@ -140,26 +139,26 @@ static WriterCaps_t caps_mp3 = {
"mp3", "mp3",
eAudio, eAudio,
"A_MP3", "A_MP3",
AUDIO_ENCODING_MP3, AUDIO_ENCODING_MP3
}; };
struct Writer_s WriterAudioMP3 = { struct Writer_s WriterAudioMP3 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_mp3, &caps_mp3
}; };
static WriterCaps_t caps_mpegl3 = { static WriterCaps_t caps_mpegl3 = {
"mpeg/l3", "mpeg/l3",
eAudio, eAudio,
"A_MPEG/L3", "A_MPEG/L3",
AUDIO_ENCODING_MPEG2, AUDIO_ENCODING_MPEG2
}; };
struct Writer_s WriterAudioMPEGL3 = { struct Writer_s WriterAudioMPEGL3 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_mpegl3, &caps_mpegl3
}; };

View File

@@ -55,16 +55,15 @@
#ifdef MPEG2_DEBUG #ifdef MPEG2_DEBUG
static short debug_level = 0; static short debug_level = 0;
static const char *FILENAME = "mpeg2.c";
#define mpeg2_printf(level, fmt, x...) do { \ #define mpeg2_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define mpeg2_printf(level, fmt, x...) #define mpeg2_printf(level, fmt, x...)
#endif #endif
#ifndef MPEG2_SILENT #ifndef MPEG2_SILENT
#define mpeg2_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define mpeg2_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define mpeg2_err(fmt, x...) #define mpeg2_err(fmt, x...)
#endif #endif
@@ -154,26 +153,26 @@ static WriterCaps_t caps = {
"mpeg2", "mpeg2",
eVideo, eVideo,
"V_MPEG2", "V_MPEG2",
VIDEO_ENCODING_AUTO, VIDEO_ENCODING_AUTO
}; };
struct Writer_s WriterVideoMPEG2 = { struct Writer_s WriterVideoMPEG2 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps, &caps
}; };
static WriterCaps_t h264_caps = { static WriterCaps_t h264_caps = {
"mpges_h264", "mpges_h264",
eVideo, eVideo,
"V_MPEG2/H264", "V_MPEG2/H264",
VIDEO_ENCODING_H264, VIDEO_ENCODING_H264
}; };
struct Writer_s WriterVideoMPEGH264 = { struct Writer_s WriterVideoMPEGH264 = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&h264_caps, &h264_caps
}; };

View File

@@ -55,16 +55,15 @@
#ifdef PCM_DEBUG #ifdef PCM_DEBUG
static short debug_level = 1; static short debug_level = 1;
static const char *FILENAME = "pcm.c";
#define pcm_printf(level, fmt, x...) do { \ #define pcm_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define pcm_printf(level, fmt, x...) #define pcm_printf(level, fmt, x...)
#endif #endif
#ifndef PCM_SILENT #ifndef PCM_SILENT
#define pcm_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define pcm_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define pcm_err(fmt, x...) #define pcm_err(fmt, x...)
#endif #endif
@@ -320,27 +319,26 @@ static WriterCaps_t caps_pcm = {
"pcm", "pcm",
eAudio, eAudio,
"A_PCM", "A_PCM",
AUDIO_ENCODING_LPCMA, AUDIO_ENCODING_LPCMA
}; };
struct Writer_s WriterAudioPCM = { struct Writer_s WriterAudioPCM = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_pcm, &caps_pcm
}; };
static WriterCaps_t caps_ipcm = { static WriterCaps_t caps_ipcm = {
"ipcm", "ipcm",
eAudio, eAudio,
"A_IPCM", "A_IPCM",
AUDIO_ENCODING_LPCMA, AUDIO_ENCODING_LPCMA
}; };
struct Writer_s WriterAudioIPCM = { struct Writer_s WriterAudioIPCM = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_ipcm, &caps_ipcm
}; };

View File

@@ -90,11 +90,8 @@ int InsertPesHeader (unsigned char *data, int size, unsigned char stream_id, uns
{ {
BitPacker_t ld2 = {data, 0, 32}; BitPacker_t ld2 = {data, 0, 32};
#if 0
/* does not seem to hurt, at least with h264 data...? */
if (size > MAX_PES_PACKET_SIZE) if (size > MAX_PES_PACKET_SIZE)
printf("%s: Packet bigger than 63.9K eeeekkkkk\n",__FUNCTION__); 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

@@ -66,16 +66,15 @@
#ifdef VC1_DEBUG #ifdef VC1_DEBUG
static short debug_level = 10; static short debug_level = 10;
static const char *FILENAME = "vc1.c";
#define vc1_printf(level, fmt, x...) do { \ #define vc1_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define vc1_printf(level, fmt, x...) #define vc1_printf(level, fmt, x...)
#endif #endif
#ifndef VC1_SILENT #ifndef VC1_SILENT
#define vc1_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define vc1_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define vc1_err(fmt, x...) #define vc1_err(fmt, x...)
#endif #endif
@@ -290,4 +289,3 @@ struct Writer_s WriterVideoVC1 = {
NULL, NULL,
&caps &caps
}; };

View File

@@ -54,16 +54,15 @@
#ifdef VORBIS_DEBUG #ifdef VORBIS_DEBUG
static short debug_level = 1; static short debug_level = 1;
static const char *FILENAME = "vorbis.c";
#define vorbis_printf(level, fmt, x...) do { \ #define vorbis_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define vorbis_printf(level, fmt, x...) #define vorbis_printf(level, fmt, x...)
#endif #endif
#ifndef VORBIS_SILENT #ifndef VORBIS_SILENT
#define vorbis_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define vorbis_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define vorbis_err(fmt, x...) #define vorbis_err(fmt, x...)
#endif #endif
@@ -140,13 +139,12 @@ static WriterCaps_t caps_vorbis = {
"vorbis", "vorbis",
eAudio, eAudio,
"A_VORBIS", "A_VORBIS",
AUDIO_ENCODING_VORBIS, AUDIO_ENCODING_VORBIS
}; };
struct Writer_s WriterAudioVORBIS = { struct Writer_s WriterAudioVORBIS = {
&reset, &reset,
&writeData, &writeData,
NULL, NULL,
&caps_vorbis, &caps_vorbis
}; };

View File

@@ -55,16 +55,15 @@
#ifdef WMA_DEBUG #ifdef WMA_DEBUG
static short debug_level = 10; static short debug_level = 10;
static const char *FILENAME = "wma.c";
#define wma_printf(level, fmt, x...) do { \ #define wma_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define wma_printf(level, fmt, x...) #define wma_printf(level, fmt, x...)
#endif #endif
#ifndef WMA_SILENT #ifndef WMA_SILENT
#define wma_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define wma_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define wma_err(fmt, x...) #define wma_err(fmt, x...)
#endif #endif

View File

@@ -62,16 +62,15 @@
#ifdef WMV_DEBUG #ifdef WMV_DEBUG
static short debug_level = 10; static short debug_level = 10;
static const char *FILENAME = "wmv.c";
#define wmv_printf(level, fmt, x...) do { \ #define wmv_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define wmv_printf(level, fmt, x...) #define wmv_printf(level, fmt, x...)
#endif #endif
#ifndef WMV_SILENT #ifndef WMV_SILENT
#define wmv_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define wmv_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define wmv_err(fmt, x...) #define wmv_err(fmt, x...)
#endif #endif
@@ -278,4 +277,3 @@ struct Writer_s WriterVideoWMV = {
NULL, NULL,
&caps &caps
}; };

View File

@@ -138,4 +138,3 @@ Writer_t* getDefaultFramebufferWriter()
return NULL; return NULL;
} }

View File

@@ -31,16 +31,15 @@
static short debug_level = 10; static short debug_level = 10;
static const char *FILENAME = "playback.c";
#ifdef PLAYBACK_DEBUG #ifdef PLAYBACK_DEBUG
#define playback_printf(level, fmt, x...) do { \ #define playback_printf(level, fmt, x...) do { \
if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define playback_printf(level, fmt, x...) #define playback_printf(level, fmt, x...)
#endif #endif
#ifndef PLAYBACK_SILENT #ifndef PLAYBACK_SILENT
#define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
#else #else
#define playback_err(fmt, x...) #define playback_err(fmt, x...)
#endif #endif
@@ -227,7 +226,7 @@ static int PlaybackOpen(Context_t *context, char * uri) {
//free(extension); //free(extension);
} /* http */ } /* http */
else if (!strncmp("mms://", uri, 6) || !strncmp("rtsp://", uri, 7) || !strncmp("rtmp://", uri, 7)) { else if (!strncmp("mms://", uri, 6) || !strncmp("rtsp://", uri, 7) || !strncmp("rtmp://", uri, 7) || !strncmp("rtmpt://", uri, 8) || !strncmp("rtmpe://", uri, 8) || !strncmp("rtmpte://", uri, 9) || !strncmp("rtmps://", uri, 8) || !strncmp("rtp://", uri, 6)) {
/* char * extension = NULL; */ /* char * extension = NULL; */
context->playback->isFile = 0; context->playback->isFile = 0;
context->playback->isHttp = 1; context->playback->isHttp = 1;
@@ -762,7 +761,7 @@ static int PlaybackSeek(Context_t *context, float * pos) {
playback_printf(10, "pos: %f\n", *pos); playback_printf(10, "pos: %f\n", *pos);
if (!context->playback->isHttp && context->playback->isPlaying && !context->playback->isForwarding && !context->playback->BackWard && !context->playback->SlowMotion && !context->playback->isPaused) { if (context->playback->isPlaying && !context->playback->isForwarding && !context->playback->BackWard && !context->playback->SlowMotion && !context->playback->isPaused) {
context->playback->isSeeking = 1; context->playback->isSeeking = 1;
context->output->Command(context, OUTPUT_CLEAR, NULL); context->output->Command(context, OUTPUT_CLEAR, NULL);
@@ -1058,5 +1057,5 @@ PlaybackHandler_t PlaybackHandler = {
0, 0,
&Command, &Command,
"", "",
0, 0
}; };

View File

@@ -16,81 +16,84 @@ static AVFormatContext* avContext = NULL;
void dump_metadata() void dump_metadata()
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
AVDictionaryEntry *tag = NULL;
while ((tag = av_dict_get(avContext->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#else
AVMetadataTag *tag = NULL; AVMetadataTag *tag = NULL;
while ((tag = av_metadata_get(avContext->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) while ((tag = av_metadata_get(avContext->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
#else
AVDictionaryEntry *tag = NULL;
while ((tag = av_dict_get(avContext->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#endif #endif
printf("%s: %s\n", tag->key, tag->value); printf("%s: %s\n", tag->key, tag->value);
} }
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
char file[255] = {""}; char file[255] = {""};
int err, i; int err, i;
if (argc < 2) if (argc < 2)
{ {
printf("give me a filename please\n"); printf("give me a filename please\n");
return -1; return -1;
} }
if (strstr(argv[1], "://") == NULL) if (strstr(argv[1], "://") == NULL)
{ {
strcpy(file, "file://"); strcpy(file, "file://");
} }
strcat(file, argv[1]); strcat(file, argv[1]);
av_register_all(); av_register_all();
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
if ((err = avformat_open_input(&avContext, file, NULL, 0)) != 0) {
#else
if ((err = av_open_input_file(&avContext, file, NULL, 0, NULL)) != 0) { if ((err = av_open_input_file(&avContext, file, NULL, 0, NULL)) != 0) {
#else
if ((err = avformat_open_input(&avContext, file, NULL, 0)) != 0) {
#endif #endif
char error[512]; char error[512];
#if LIBAVCODEC_VERSION_MAJOR < 54
printf("av_open_input_file failed %d (%s)\n", err, file); printf("av_open_input_file failed %d (%s)\n", err, file);
#else
printf("avformat_open_input failed %d (%s)\n", err, file);
#endif
av_strerror(err, error, 512); av_strerror(err, error, 512);
printf("Cause: %s\n", error); printf("Cause: %s\n", error);
return -1; return -1;
} }
if (av_find_stream_info(avContext) < 0) if (av_find_stream_info(avContext) < 0)
{ {
printf("Error av_find_stream_info\n"); printf("Error av_find_stream_info\n");
} }
printf("\n***\n"); printf("\n***\n");
dump_metadata(); dump_metadata();
printf("\nstream specific metadata:\n"); printf("\nstream specific metadata:\n");
for (i = 0; i < avContext->nb_streams; i++) for (i = 0; i < avContext->nb_streams; i++)
{ {
AVStream* stream = avContext->streams[i]; AVStream* stream = avContext->streams[i];
if (stream) if (stream)
{ {
#if LIBAVFORMAT_VERSION_MAJOR > 53 #if LIBAVCODEC_VERSION_MAJOR < 54
AVDictionaryEntry *tag = NULL;
#else
AVMetadataTag *tag = NULL; AVMetadataTag *tag = NULL;
#endif
if (stream->metadata != NULL)
#if LIBAVFORMAT_VERSION_MAJOR > 53
while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#else #else
AVDictionaryEntry *tag = NULL;
#endif
if (stream->metadata != NULL)
#if LIBAVCODEC_VERSION_MAJOR < 54
while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
#else
while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
#endif #endif
printf("%s: %s\n", tag->key, tag->value); printf("%s: %s\n", tag->key, tag->value);
} }
} }
return 0; return 0;
} }