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;
#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

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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 */

View File

@@ -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);
if(PacketData != NULL)
{
memcpy(PacketData, PesHeader, HeaderLength);
memcpy(PacketData + HeaderLength, call->data, call->len);
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);

View File

@@ -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
};

View File

@@ -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;
}