diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index 3a53fea..de05dbb 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -59,13 +59,13 @@ static short debug_level = 10; #define ffmpeg_printf(level, fmt, x...) do { \ -if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define ffmpeg_printf(level, fmt, x...) #endif #ifndef FFMPEG_SILENT -#define ffmpeg_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +#define ffmpeg_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define ffmpeg_err(fmt, x...) #endif @@ -83,7 +83,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); #define cERR_CONTAINER_FFMPEG_ERR -9 #define cERR_CONTAINER_FFMPEG_END_OF_FILE -10 -static const char* FILENAME = __FILE__; +static const char* FILENAME = "container_ffmpeg.c"; /* ***************************** */ /* Types */ @@ -909,15 +909,17 @@ int container_ffmpeg_init(Context_t *context, char * filename) } avContext->flags = AVFMT_FLAG_GENPTS; + if (context->playback->noprobe) + avContext->max_analyze_duration = 1; ffmpeg_printf(20, "find_streaminfo\n"); #if LIBAVCODEC_VERSION_MAJOR < 54 if (av_find_stream_info(avContext) < 0) { - ffmpeg_err("Error avformat_find_stream_info\n"); + ffmpeg_err("Error av_find_stream_info\n"); #else if (avformat_find_stream_info(avContext, NULL) < 0) { - ffmpeg_err("Error av_find_stream_info\n"); + ffmpeg_err("Error avformat_find_stream_info\n"); #endif #ifdef this_is_ok /* crow reports that sometimes this returns an error diff --git a/libeplayer3/container/text_srt.c b/libeplayer3/container/text_srt.c index 4a0712a..71c71d9 100644 --- a/libeplayer3/container/text_srt.c +++ b/libeplayer3/container/text_srt.c @@ -50,13 +50,13 @@ static short debug_level = 10; #define srt_printf(level, fmt, x...) do { \ -if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define srt_printf(level, fmt, x...) #endif #ifndef SRT_SILENT -#define srt_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +#define srt_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define srt_err(fmt, x...) #endif @@ -68,7 +68,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); #define TRACKWRAP 20 #define MAXLINELENGTH 80 -static const char FILENAME[] = __FILE__; +static const char FILENAME[] = "text_srt.c"; /* ***************************** */ /* Types */ @@ -290,14 +290,14 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) { copyFilename = strdup(Filename); - FilenameFolder = dirname(copyFilename); - - if (FilenameFolder == NULL) + if (copyFilename == NULL) { - srt_err("FilenameFolder NULL\n"); + srt_err("copyFilename NULL\n"); return cERR_SRT_ERROR; } + FilenameFolder = dirname(copyFilename); + srt_printf(10, "folder: %s\n", FilenameFolder); getExtension(copyFilename, &FilenameExtension); @@ -305,7 +305,7 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) { if (FilenameExtension == NULL) { srt_err("FilenameExtension NULL\n"); - free(FilenameFolder); + free(copyFilename); return cERR_SRT_ERROR; } diff --git a/libeplayer3/container/text_ssa.c b/libeplayer3/container/text_ssa.c index 374c254..c970c2e 100644 --- a/libeplayer3/container/text_ssa.c +++ b/libeplayer3/container/text_ssa.c @@ -50,13 +50,13 @@ static short debug_level = 10; #define ssa_printf(level, fmt, x...) do { \ -if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define ssa_printf(level, fmt, x...) #endif #ifndef SSA_SILENT -#define ssa_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +#define ssa_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define ssa_err(fmt, x...) #endif @@ -71,7 +71,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); //Buffer size used in getLine function. Do not set to value less than 1 !!! #define SSA_BUFFER_SIZE 14 -static const char FILENAME[] = __FILE__; +static const char FILENAME[] = "text_ssa.c"; /* ***************************** */ /* Types */ @@ -291,14 +291,14 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) { copyFilename = strdup(Filename); - FilenameFolder = dirname(copyFilename); - - if (FilenameFolder == NULL) + if (copyFilename == NULL) { - ssa_err("FilenameFolder NULL\n"); + ssa_err("copyFilename NULL\n"); return cERR_SSA_ERROR; } + FilenameFolder = dirname(copyFilename); + ssa_printf(10, "folder: %s\n", FilenameFolder); getExtension(copyFilename, &FilenameExtension); @@ -306,7 +306,7 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) { if (FilenameExtension == NULL) { ssa_err("FilenameExtension NULL\n"); - free(FilenameFolder); + free(copyFilename); return cERR_SSA_ERROR; } diff --git a/libeplayer3/include/playback.h b/libeplayer3/include/playback.h index 3b396af..a7fa6aa 100644 --- a/libeplayer3/include/playback.h +++ b/libeplayer3/include/playback.h @@ -39,6 +39,7 @@ typedef struct PlaybackHandler_s { int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *); char * uri; off_t size; + unsigned char noprobe; /* hack: only minimal probing in av_find_stream_info */ } PlaybackHandler_t; #endif diff --git a/libeplayer3/output/output.c b/libeplayer3/output/output.c index 58a4b44..901ea49 100644 --- a/libeplayer3/output/output.c +++ b/libeplayer3/output/output.c @@ -58,7 +58,7 @@ if (debug_level >= level) printf(x); } while (0) #define cERR_OUTPUT_NO_ERROR 0 #define cERR_OUTPUT_INTERNAL_ERROR -1 -static const char* FILENAME = __FILE__; +static const char* FILENAME = "output.c"; /* ***************************** */ /* Types */ diff --git a/libeplayer3/output/writer/h263.c b/libeplayer3/output/writer/h263.c index 856ef2e..01caf4e 100644 --- a/libeplayer3/output/writer/h263.c +++ b/libeplayer3/output/writer/h263.c @@ -57,15 +57,16 @@ #ifdef H263_DEBUG static short debug_level = 0; +static const char *FILENAME = "h263.c"; #define h263_printf(level, fmt, x...) do { \ -if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define h263_printf(level, fmt, x...) #endif #ifndef H263_SILENT -#define h263_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +#define h263_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define h263_err(fmt, x...) #endif @@ -143,14 +144,21 @@ static int writeData(void* _call) iov[1].iov_len = call->len; len = writev(call->fd, iov, 2); #else - unsigned char *PacketData = call->data - HeaderLength; + unsigned char *PacketData = malloc(HeaderLength + call->len); - memcpy(DataCopy, PacketData, HeaderLength); - memcpy(PacketData, PesHeader, HeaderLength); + if(PacketData != NULL) + { + memcpy(PacketData, PesHeader, HeaderLength); + memcpy(PacketData + HeaderLength, call->data, call->len); - len = write(call->fd, PacketData, call->len + HeaderLength); + len = write(call->fd, PacketData, call->len + HeaderLength); - memcpy(PacketData, DataCopy, HeaderLength); + free(PacketData); + } + else + { + h263_err("no mem\n"); + } #endif h263_printf(10, "< len %d\n", len); diff --git a/libeplayer3/playback/playback.c b/libeplayer3/playback/playback.c index 5a3320a..860dec3 100644 --- a/libeplayer3/playback/playback.c +++ b/libeplayer3/playback/playback.c @@ -31,15 +31,16 @@ static short debug_level = 10; +static const char *FILENAME = "playback.c"; #ifdef PLAYBACK_DEBUG #define playback_printf(level, fmt, x...) do { \ -if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define playback_printf(level, fmt, x...) #endif #ifndef PLAYBACK_SILENT -#define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) +#define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0) #else #define playback_err(fmt, x...) #endif @@ -166,11 +167,17 @@ static int PlaybackOpen(Context_t *context, char * uri) { context->playback->uri = strdup(uri); if (!context->playback->isPlaying) { - if (!strncmp("file://", uri, 7)) { + if (!strncmp("file://", uri, 7) || !strncmp("myts://", uri, 7)) { char * extension = NULL; context->playback->isFile = 1; context->playback->isHttp = 0; context->playback->isUPNP = 0; + if (!strncmp("myts://", uri, 7)) { + memcpy(context->playback->uri, "file", 4); + memcpy(uri, "file", 4); + context->playback->noprobe = 1; + } else + context->playback->noprobe = 0; getExtension(uri+7, &extension); @@ -1149,5 +1156,6 @@ PlaybackHandler_t PlaybackHandler = { #endif &Command, "", + 0, 0 }; diff --git a/libeplayer3/tools/eplayer2.c b/libeplayer3/tools/eplayer2.c index 2b8bbc2..476ed4f 100644 --- a/libeplayer3/tools/eplayer2.c +++ b/libeplayer3/tools/eplayer2.c @@ -74,14 +74,14 @@ void framebuffer_init() fd = open("/dev/fb0", O_RDWR); - if (fd < 0) - { + if (fd < 0) + { perror("/dev/fb0"); return; } - if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo) < 0) - { + if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo) < 0) + { perror("FBIOGET_VSCREENINFO"); return; } @@ -90,7 +90,7 @@ void framebuffer_init() ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo); - printf("mode %d, %d, %d\n", screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel); + printf("mode %d, %d, %d\n", screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel); if (ioctl(fd, FBIOGET_FSCREENINFO, &fix)<0) { @@ -98,21 +98,21 @@ void framebuffer_init() printf("fb failed\n"); } - stride = fix.line_length; + stride = fix.line_length; xRes = screeninfo.xres; yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; - printf("stride = %d, width %d\n", stride, xRes); + printf("stride = %d, width %d\n", stride, xRes); available = fix.smem_len; - - printf("%dk video mem\n", available/1024); - - lfb = (unsigned char*) mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); - if (lfb == NULL) - { + printf("%dk video mem\n", available/1024); + + lfb = (unsigned char*) mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); + + if (lfb == NULL) + { perror("mmap"); return; } @@ -146,7 +146,7 @@ int main(int argc,char* argv[]) { { showInfos = 1; } - + if(argc == 3 && !strcmp(argv[2], "-n")) noinput = 1; @@ -173,7 +173,7 @@ int main(int argc,char* argv[]) { out.destination = lfb; out.destStride = stride; out.shareFramebuffer = 1; - + player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out); if(player->playback->Command(player, PLAYBACK_OPEN, file) < 0) @@ -299,19 +299,19 @@ int main(int argc,char* argv[]) { }*/ while(player->playback->isPlaying) { - int Key = 0; + int Key = 0; + + if(kbhit()) + if(noinput == 0) + Key = getchar(); - if(kbhit()) - if(noinput == 0) - Key = getchar(); - if(!player->playback->isPlaying) { break; } - + if(Key == 0) - continue; - + continue; + switch (Key) { case 'a': { int Key2 = getchar(); @@ -415,10 +415,10 @@ int main(int argc,char* argv[]) { break; case 'f': { - + if (speed < 0) speed = 0; - + speed++; if (speed > 7) @@ -434,7 +434,7 @@ int main(int argc,char* argv[]) { case 6: speedmap = 63; break; case 7: speedmap = 127; break; } - + player->playback->Command(player, PLAYBACK_FASTFORWARD, &speedmap); break; } @@ -442,9 +442,9 @@ int main(int argc,char* argv[]) { case 'b': { if (speed > 0) speed = 0; - + speed--; - + if (speed < -7) speed = -1; @@ -464,14 +464,14 @@ int main(int argc,char* argv[]) { } #if defined(VDR1722) case 'g': { - char gotoString [256]; - gets (gotoString); + char gotoString [256]; + gets (gotoString); int gotoPos = atoi(gotoString); - double length = 0; - float sec; + double length = 0; + float sec; - printf("gotoPos %i\n", gotoPos); + printf("gotoPos %i\n", gotoPos); if (player->container && player->container->selectedContainer) player->container->selectedContainer->Command(player, CONTAINER_LENGTH, &length); diff --git a/libspark/playback_libeplayer3.cpp b/libspark/playback_libeplayer3.cpp index 87249db..74ad61f 100644 --- a/libspark/playback_libeplayer3.cpp +++ b/libspark/playback_libeplayer3.cpp @@ -126,6 +126,8 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s printf("upnp://\n"); isHTTP = true; } + else if (pm == PLAYMODE_TS) + strcat(file, "myts://"); else strcat(file, "file://"); @@ -371,7 +373,7 @@ bool cPlayback::SetSpeed(int speed) bool cPlayback::GetSpeed(int &speed) const { - printf("%s:%s\n", FILENAME, __FUNCTION__); + //printf("%s:%s\n", FILENAME, __FUNCTION__); speed = nPlaybackSpeed; return true; }