This commit is contained in:
martii
2012-10-04 09:32:05 +02:00
9 changed files with 87 additions and 66 deletions

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, __FILE__, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x); } while (0) #define ffmpeg_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __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 = __FILE__; static const char* FILENAME = "container_ffmpeg.c";
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -909,15 +909,17 @@ int container_ffmpeg_init(Context_t *context, char * filename)
} }
avContext->flags = AVFMT_FLAG_GENPTS; avContext->flags = AVFMT_FLAG_GENPTS;
if (context->playback->noprobe)
avContext->max_analyze_duration = 1;
ffmpeg_printf(20, "find_streaminfo\n"); ffmpeg_printf(20, "find_streaminfo\n");
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
if (av_find_stream_info(avContext) < 0) { if (av_find_stream_info(avContext) < 0) {
ffmpeg_err("Error avformat_find_stream_info\n"); ffmpeg_err("Error av_find_stream_info\n");
#else #else
if (avformat_find_stream_info(avContext, NULL) < 0) { 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 #endif
#ifdef this_is_ok #ifdef this_is_ok
/* crow reports that sometimes this returns an error /* crow reports that sometimes this returns an error

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, __FILE__, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x); } while (0) #define srt_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x);
#define TRACKWRAP 20 #define TRACKWRAP 20
#define MAXLINELENGTH 80 #define MAXLINELENGTH 80
static const char FILENAME[] = __FILE__; static const char FILENAME[] = "text_srt.c";
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -290,14 +290,14 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
copyFilename = strdup(Filename); copyFilename = strdup(Filename);
FilenameFolder = dirname(copyFilename); if (copyFilename == NULL)
if (FilenameFolder == NULL)
{ {
srt_err("FilenameFolder NULL\n"); srt_err("copyFilename NULL\n");
return cERR_SRT_ERROR; return cERR_SRT_ERROR;
} }
FilenameFolder = dirname(copyFilename);
srt_printf(10, "folder: %s\n", FilenameFolder); srt_printf(10, "folder: %s\n", FilenameFolder);
getExtension(copyFilename, &FilenameExtension); getExtension(copyFilename, &FilenameExtension);
@@ -305,7 +305,7 @@ static int SrtGetSubtitle(Context_t *context, char * Filename) {
if (FilenameExtension == NULL) if (FilenameExtension == NULL)
{ {
srt_err("FilenameExtension NULL\n"); srt_err("FilenameExtension NULL\n");
free(FilenameFolder); free(copyFilename);
return cERR_SRT_ERROR; return cERR_SRT_ERROR;
} }

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, __FILE__, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x); } while (0) #define ssa_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __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[] = __FILE__; static const char FILENAME[] = "text_ssa.c";
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
@@ -291,14 +291,14 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) {
copyFilename = strdup(Filename); copyFilename = strdup(Filename);
FilenameFolder = dirname(copyFilename); if (copyFilename == NULL)
if (FilenameFolder == NULL)
{ {
ssa_err("FilenameFolder NULL\n"); ssa_err("copyFilename NULL\n");
return cERR_SSA_ERROR; return cERR_SSA_ERROR;
} }
FilenameFolder = dirname(copyFilename);
ssa_printf(10, "folder: %s\n", FilenameFolder); ssa_printf(10, "folder: %s\n", FilenameFolder);
getExtension(copyFilename, &FilenameExtension); getExtension(copyFilename, &FilenameExtension);
@@ -306,7 +306,7 @@ static int SsaGetSubtitle(Context_t *context, char * Filename) {
if (FilenameExtension == NULL) if (FilenameExtension == NULL)
{ {
ssa_err("FilenameExtension NULL\n"); ssa_err("FilenameExtension NULL\n");
free(FilenameFolder); free(copyFilename);
return cERR_SSA_ERROR; return cERR_SSA_ERROR;
} }

View File

@@ -39,6 +39,7 @@ typedef struct PlaybackHandler_s {
int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *); int (* Command) (/*Context_t*/void *, PlaybackCmd_t, void *);
char * uri; char * uri;
off_t size; off_t size;
unsigned char noprobe; /* hack: only minimal probing in av_find_stream_info */
} PlaybackHandler_t; } PlaybackHandler_t;
#endif #endif

View File

@@ -58,7 +58,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 = __FILE__; static const char* FILENAME = "output.c";
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */

View File

@@ -57,15 +57,16 @@
#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, __FILE__, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x); } while (0) #define h263_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0)
#else #else
#define h263_err(fmt, x...) #define h263_err(fmt, x...)
#endif #endif
@@ -143,14 +144,21 @@ static int writeData(void* _call)
iov[1].iov_len = call->len; iov[1].iov_len = call->len;
len = writev(call->fd, iov, 2); len = writev(call->fd, iov, 2);
#else #else
unsigned char *PacketData = call->data - HeaderLength; unsigned char *PacketData = malloc(HeaderLength + call->len);
memcpy(DataCopy, PacketData, HeaderLength); if(PacketData != NULL)
memcpy(PacketData, PesHeader, HeaderLength); {
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 #endif
h263_printf(10, "< len %d\n", len); h263_printf(10, "< len %d\n", len);

View File

@@ -31,15 +31,16 @@
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, __FILE__, __FUNCTION__, ## x); } while (0) if (debug_level >= level) printf("[%s:%s] " fmt, FILENAME, __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, __FILE__, __FUNCTION__, ## x); } while (0) #define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, FILENAME, __FUNCTION__, ## x); } while (0)
#else #else
#define playback_err(fmt, x...) #define playback_err(fmt, x...)
#endif #endif
@@ -166,11 +167,17 @@ static int PlaybackOpen(Context_t *context, char * uri) {
context->playback->uri = strdup(uri); context->playback->uri = strdup(uri);
if (!context->playback->isPlaying) { if (!context->playback->isPlaying) {
if (!strncmp("file://", uri, 7)) { if (!strncmp("file://", uri, 7) || !strncmp("myts://", uri, 7)) {
char * extension = NULL; char * extension = NULL;
context->playback->isFile = 1; context->playback->isFile = 1;
context->playback->isHttp = 0; context->playback->isHttp = 0;
context->playback->isUPNP = 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); getExtension(uri+7, &extension);
@@ -1149,5 +1156,6 @@ PlaybackHandler_t PlaybackHandler = {
#endif #endif
&Command, &Command,
"", "",
0,
0 0
}; };

View File

@@ -75,13 +75,13 @@ void framebuffer_init()
fd = open("/dev/fb0", O_RDWR); fd = open("/dev/fb0", O_RDWR);
if (fd < 0) if (fd < 0)
{ {
perror("/dev/fb0"); perror("/dev/fb0");
return; return;
} }
if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo) < 0) if (ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo) < 0)
{ {
perror("FBIOGET_VSCREENINFO"); perror("FBIOGET_VSCREENINFO");
return; return;
} }
@@ -90,7 +90,7 @@ void framebuffer_init()
ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo); 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) if (ioctl(fd, FBIOGET_FSCREENINFO, &fix)<0)
{ {
@@ -98,21 +98,21 @@ void framebuffer_init()
printf("fb failed\n"); printf("fb failed\n");
} }
stride = fix.line_length; stride = fix.line_length;
xRes = screeninfo.xres; xRes = screeninfo.xres;
yRes = screeninfo.yres; yRes = screeninfo.yres;
bpp = screeninfo.bits_per_pixel; 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; available = fix.smem_len;
printf("%dk video mem\n", available/1024); printf("%dk video mem\n", available/1024);
lfb = (unsigned char*) mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); lfb = (unsigned char*) mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0);
if (lfb == NULL) if (lfb == NULL)
{ {
perror("mmap"); perror("mmap");
return; return;
} }
@@ -299,18 +299,18 @@ int main(int argc,char* argv[]) {
}*/ }*/
while(player->playback->isPlaying) { while(player->playback->isPlaying) {
int Key = 0; int Key = 0;
if(kbhit()) if(kbhit())
if(noinput == 0) if(noinput == 0)
Key = getchar(); Key = getchar();
if(!player->playback->isPlaying) { if(!player->playback->isPlaying) {
break; break;
} }
if(Key == 0) if(Key == 0)
continue; continue;
switch (Key) { switch (Key) {
case 'a': { case 'a': {
@@ -464,14 +464,14 @@ int main(int argc,char* argv[]) {
} }
#if defined(VDR1722) #if defined(VDR1722)
case 'g': { case 'g': {
char gotoString [256]; char gotoString [256];
gets (gotoString); gets (gotoString);
int gotoPos = atoi(gotoString); int gotoPos = atoi(gotoString);
double length = 0; double length = 0;
float sec; float sec;
printf("gotoPos %i\n", gotoPos); printf("gotoPos %i\n", gotoPos);
if (player->container && player->container->selectedContainer) if (player->container && player->container->selectedContainer)
player->container->selectedContainer->Command(player, CONTAINER_LENGTH, &length); player->container->selectedContainer->Command(player, CONTAINER_LENGTH, &length);

View File

@@ -126,6 +126,8 @@ bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned s
printf("upnp://\n"); printf("upnp://\n");
isHTTP = true; isHTTP = true;
} }
else if (pm == PLAYMODE_TS)
strcat(file, "myts://");
else else
strcat(file, "file://"); strcat(file, "file://");
@@ -371,7 +373,7 @@ bool cPlayback::SetSpeed(int speed)
bool cPlayback::GetSpeed(int &speed) const bool cPlayback::GetSpeed(int &speed) const
{ {
printf("%s:%s\n", FILENAME, __FUNCTION__); //printf("%s:%s\n", FILENAME, __FUNCTION__);
speed = nPlaybackSpeed; speed = nPlaybackSpeed;
return true; return true;
} }