mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-28 16:01:22 +02:00
Refactoring debug code
Conflicts: libeplayer3-arm/container/container_ffmpeg.c
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "misc.h"
|
||||
#include "writer.h"
|
||||
|
||||
@@ -62,29 +63,6 @@ typedef struct BufferingNode_s
|
||||
#define cERR_LINUX_DVB_BUFFERING_NO_ERROR 0
|
||||
#define cERR_LINUX_DVB_BUFFERING_ERROR -1
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define LINUX_DVB_BUFFERING_DEBUG
|
||||
#else
|
||||
#define LINUX_DVB_BUFFERING_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_DVB_BUFFERING_DEBUG
|
||||
|
||||
static const uint16_t debug_level = 40;
|
||||
|
||||
#define buff_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%d:%s] " fmt, __FILE__, __LINE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define buff_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef LINUX_DVB_BUFFERING_SILENT
|
||||
#define buff_err(fmt, x...) do { printf("[%s:%d:%s] " fmt, __FILE__, __LINE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define buff_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Variables */
|
||||
/* ***************************** */
|
||||
|
529
libeplayer3-arm/output/linuxdvb_fake.c
Normal file
529
libeplayer3-arm/output/linuxdvb_fake.c
Normal file
@@ -0,0 +1,529 @@
|
||||
/*
|
||||
* LinuxDVB Output handling.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/* ***************************** */
|
||||
/* Includes */
|
||||
/* ***************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "output.h"
|
||||
#include "writer.h"
|
||||
#include "misc.h"
|
||||
#include "pes.h"
|
||||
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#define cERR_LINUXDVB_NO_ERROR 0
|
||||
#define cERR_LINUXDVB_ERROR -1
|
||||
|
||||
static const char VIDEODEV[] = "/tmp/e2i_video0";
|
||||
static const char AUDIODEV[] = "/tmp/e2i_audio0";
|
||||
|
||||
static int videofd = -1;
|
||||
static int audiofd = -1;
|
||||
|
||||
struct DVBApiVideoInfo_s
|
||||
{
|
||||
int aspect_ratio;
|
||||
int progressive;
|
||||
int frame_rate;
|
||||
int width, height;
|
||||
};
|
||||
static struct DVBApiVideoInfo_s videoInfo = {-1, -1, -1, -1, -1};
|
||||
|
||||
unsigned long long int sCURRENT_PTS = 0;
|
||||
bool isBufferedOutput = false;
|
||||
|
||||
pthread_mutex_t LinuxDVBmutex;
|
||||
|
||||
/* ***************************** */
|
||||
/* Prototypes */
|
||||
/* ***************************** */
|
||||
int32_t LinuxDvbBuffOpen(Context_t *context, char *type, int outfd);
|
||||
int32_t LinuxDvbBuffClose(Context_t *context);
|
||||
int32_t LinuxDvbBuffFlush(Context_t *context);
|
||||
int32_t LinuxDvbBuffResume(Context_t *context);
|
||||
|
||||
ssize_t BufferingWriteV(int fd, const struct iovec *iov, int ic);
|
||||
int32_t LinuxDvbBuffSetSize(const uint32_t bufferSize);
|
||||
uint32_t LinuxDvbBuffGetSize();
|
||||
|
||||
int LinuxDvbStop(Context_t *context, char *type);
|
||||
|
||||
/* ***************************** */
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
#define getLinuxDVBMutex() pthread_mutex_lock(&LinuxDVBmutex)
|
||||
#define releaseLinuxDVBMutex() pthread_mutex_unlock(&LinuxDVBmutex)
|
||||
|
||||
|
||||
int LinuxDvbOpen(Context_t *context __attribute__((unused)), char *type)
|
||||
{
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd < 0)
|
||||
{
|
||||
videofd = open(VIDEODEV, O_CREAT | O_TRUNC | O_WRONLY | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
}
|
||||
|
||||
if (audio && audiofd < 0)
|
||||
{
|
||||
audiofd = open(AUDIODEV, O_CREAT | O_TRUNC | O_WRONLY | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbClose(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbPlay(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type)
|
||||
{
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
if (ioctl(videofd, VIDEO_CONTINUE, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_CONTINUE, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("AUDIO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffResume(context);
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int LinuxDvbAudioMute(Context_t *context __attribute__((unused)), char *flag __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbSlowMotion(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbAVSync(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long int *pts)
|
||||
{
|
||||
*((unsigned long long int *)pts) = (unsigned long long int)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbGetFrameCount(Context_t *context __attribute__((unused)), unsigned long long int *frameCount __attribute__((unused)))
|
||||
{
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
int LinuxDvbSwitch(Context_t *context __attribute__((unused)), char *type __attribute__((unused)))
|
||||
{
|
||||
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
static int Write(Context_t *context, void *_out)
|
||||
{
|
||||
AudioVideoOut_t *out = (AudioVideoOut_t *) _out;
|
||||
int32_t ret = cERR_LINUXDVB_NO_ERROR;
|
||||
int32_t res = 0;
|
||||
uint8_t video = 0;
|
||||
uint8_t audio = 0;
|
||||
Writer_t *writer = NULL;
|
||||
WriterAVCallData_t call;
|
||||
|
||||
if (out == NULL)
|
||||
{
|
||||
linuxdvb_err("null pointer passed\n");
|
||||
return cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
video = !strcmp("video", out->type);
|
||||
audio = !strcmp("audio", out->type);
|
||||
|
||||
linuxdvb_printf(20, "DataLength=%u PrivateLength=%u Pts=%"PRIu64" FrameRate=%d\n",
|
||||
out->len, out->extralen, out->pts, out->frameRate);
|
||||
linuxdvb_printf(20, "v%d a%d\n", video, audio);
|
||||
|
||||
if (video)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->video->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "Encoding = %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
|
||||
writer = getDefaultVideoWriter();
|
||||
}
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown video codec and no default writer %s\n", Encoding);
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct pollfd pfd[1];
|
||||
pfd[0].fd = videofd;
|
||||
pfd[0].events = POLLPRI;
|
||||
int pollret = poll(pfd, 1, 0);
|
||||
if (pollret > 0 && pfd[0].revents & POLLPRI)
|
||||
{
|
||||
struct video_event evt;
|
||||
if (ioctl(videofd, VIDEO_GET_EVENT, &evt) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_GET_EVENT: %s\n", strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (evt.type == VIDEO_EVENT_SIZE_CHANGED)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_SIZE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "width : %d\n", evt.u.size.w);
|
||||
linuxdvb_printf(10, "height : %d\n", evt.u.size.h);
|
||||
linuxdvb_printf(10, "aspect : %d\n", evt.u.size.aspect_ratio);
|
||||
videoInfo.width = evt.u.size.w;
|
||||
videoInfo.height = evt.u.size.h;
|
||||
videoInfo.aspect_ratio = evt.u.size.aspect_ratio;
|
||||
}
|
||||
else if (evt.type == VIDEO_EVENT_FRAME_RATE_CHANGED)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_FRAME_RATE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "framerate : %d\n", evt.u.frame_rate);
|
||||
videoInfo.frame_rate = evt.u.frame_rate;
|
||||
}
|
||||
else if (evt.type == 16 /*VIDEO_EVENT_PROGRESSIVE_CHANGED*/)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_PROGRESSIVE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "progressive : %d\n", evt.u.frame_rate);
|
||||
videoInfo.progressive = evt.u.frame_rate;
|
||||
context->manager->video->Command(context, MANAGER_UPDATED_TRACK_INFO, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
linuxdvb_err("unhandled DVBAPI Video Event %d\n", evt.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
call.fd = videofd;
|
||||
call.data = out->data;
|
||||
call.len = out->len;
|
||||
call.Pts = out->pts;
|
||||
call.Dts = out->dts;
|
||||
call.private_data = out->extradata;
|
||||
call.private_size = out->extralen;
|
||||
call.FrameRate = out->frameRate;
|
||||
call.FrameScale = out->timeScale;
|
||||
call.Width = out->width;
|
||||
call.Height = out->height;
|
||||
call.InfoFlags = out->infoFlags;
|
||||
call.Version = 0;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
|
||||
if (writer->writeData)
|
||||
{
|
||||
res = writer->writeData(&call);
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
linuxdvb_err("failed to write data %d - %d\n", res, errno);
|
||||
linuxdvb_err("%s\n", strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
}
|
||||
else if (audio)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "Encoding = %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_printf(20, "searching default writer ... %s\n", Encoding);
|
||||
writer = getDefaultAudioWriter();
|
||||
}
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("unknown audio codec %s and no default writer\n", Encoding);
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
call.fd = audiofd;
|
||||
call.data = out->data;
|
||||
call.len = out->len;
|
||||
call.Pts = out->pts;
|
||||
call.Dts = out->dts;
|
||||
call.private_data = out->extradata;
|
||||
call.private_size = out->extralen;
|
||||
call.FrameRate = out->frameRate;
|
||||
call.FrameScale = out->timeScale;
|
||||
call.InfoFlags = out->infoFlags;
|
||||
call.Version = 0;
|
||||
call.WriteV = isBufferedOutput ? BufferingWriteV : writev_with_retry;
|
||||
|
||||
if (writer->writeData)
|
||||
{
|
||||
res = writer->writeData(&call);
|
||||
}
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
linuxdvb_err("failed to write data %d - %d\n", res, errno);
|
||||
linuxdvb_err("%s\n", strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int reset(Context_t *context __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Command(Context_t *context, OutputCmd_t command, void *argument)
|
||||
{
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
|
||||
linuxdvb_printf(50, "Command %d\n", command);
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case OUTPUT_OPEN:
|
||||
{
|
||||
ret = LinuxDvbOpen(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_CLOSE:
|
||||
{
|
||||
ret = LinuxDvbClose(context, (char *)argument);
|
||||
reset(context);
|
||||
sCURRENT_PTS = 0;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_PLAY: // 4
|
||||
{
|
||||
sCURRENT_PTS = 0;
|
||||
ret = LinuxDvbPlay(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_STOP:
|
||||
{
|
||||
reset(context);
|
||||
ret = LinuxDvbStop(context, (char *)argument);
|
||||
sCURRENT_PTS = 0;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_FLUSH:
|
||||
{
|
||||
ret = LinuxDvbFlush(context, (char *)argument);
|
||||
reset(context);
|
||||
sCURRENT_PTS = 0;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_PAUSE:
|
||||
{
|
||||
ret = LinuxDvbPause(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_CONTINUE:
|
||||
{
|
||||
ret = LinuxDvbContinue(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_AVSYNC:
|
||||
{
|
||||
ret = LinuxDvbAVSync(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_CLEAR:
|
||||
{
|
||||
ret = LinuxDvbClear(context, (char *)argument);
|
||||
reset(context);
|
||||
sCURRENT_PTS = 0;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_PTS:
|
||||
{
|
||||
unsigned long long int pts = 0;
|
||||
ret = LinuxDvbPts(context, &pts);
|
||||
*((unsigned long long int *)argument) = (unsigned long long int)pts;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_SWITCH:
|
||||
{
|
||||
ret = LinuxDvbSwitch(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_SLOWMOTION:
|
||||
{
|
||||
return LinuxDvbSlowMotion(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_AUDIOMUTE:
|
||||
{
|
||||
return LinuxDvbAudioMute(context, (char *)argument);
|
||||
break;
|
||||
}
|
||||
case OUTPUT_GET_FRAME_COUNT:
|
||||
{
|
||||
unsigned long long int frameCount = 0;
|
||||
ret = LinuxDvbGetFrameCount(context, &frameCount);
|
||||
*((unsigned long long int *)argument) = (unsigned long long int)frameCount;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_GET_PROGRESSIVE:
|
||||
{
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
*((int *)argument) = videoInfo.progressive;
|
||||
break;
|
||||
}
|
||||
case OUTPUT_SET_BUFFER_SIZE:
|
||||
{
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
if (!isBufferedOutput)
|
||||
{
|
||||
uint32_t bufferSize = *((uint32_t *)argument);
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
LinuxDvbBuffSetSize(bufferSize);
|
||||
isBufferedOutput = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OUTPUT_GET_BUFFER_SIZE:
|
||||
{
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
*((uint32_t *)argument) = LinuxDvbBuffGetSize();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
linuxdvb_err("ContainerCmd %d not supported!\n", command);
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
linuxdvb_printf(50, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *LinuxDvbCapabilities[] = { "audio", "video", NULL };
|
||||
|
||||
struct Output_s LinuxDvbOutput =
|
||||
{
|
||||
"LinuxDvb",
|
||||
&Command,
|
||||
&Write,
|
||||
LinuxDvbCapabilities
|
||||
};
|
@@ -22,6 +22,7 @@
|
||||
/* ***************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "output.h"
|
||||
#include "writer.h"
|
||||
#include "misc.h"
|
||||
@@ -50,29 +52,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define LINUXDVB_DEBUG
|
||||
static unsigned short debug_level = 20;
|
||||
#else
|
||||
#define LINUXDVB_SILENT
|
||||
#endif
|
||||
|
||||
static const char FILENAME[] = __FILE__;
|
||||
|
||||
#ifdef LINUXDVB_DEBUG
|
||||
#define linuxdvb_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_printf(x...)
|
||||
#endif
|
||||
|
||||
#ifndef LINUXDVB_SILENT
|
||||
#define linuxdvb_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_err(x...)
|
||||
#endif
|
||||
|
||||
#define cERR_LINUXDVB_NO_ERROR 0
|
||||
#define cERR_LINUXDVB_ERROR -1
|
||||
|
||||
@@ -114,15 +93,8 @@ int LinuxDvbStop(Context_t *context, char *type);
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
void getLinuxDVBMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused)))
|
||||
{
|
||||
pthread_mutex_lock(&LinuxDVBmutex);
|
||||
}
|
||||
|
||||
void releaseLinuxDVBMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused)))
|
||||
{
|
||||
pthread_mutex_unlock(&LinuxDVBmutex);
|
||||
}
|
||||
#define getLinuxDVBMutex() pthread_mutex_lock(&LinuxDVBmutex)
|
||||
#define releaseLinuxDVBMutex() pthread_mutex_unlock(&LinuxDVBmutex)
|
||||
|
||||
static int LinuxDvbMapBypassMode(int bypass)
|
||||
{
|
||||
@@ -214,7 +186,7 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
*/
|
||||
LinuxDvbStop(context, type);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffClose(context);
|
||||
@@ -230,7 +202,7 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
audiofd = -1;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -335,7 +307,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -370,7 +342,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
ioctl(audiofd, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX);
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -383,7 +355,7 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -403,7 +375,7 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -495,19 +467,20 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
// konfetti comment: speed is a value given in skipped frames
|
||||
if (ioctl(videofd, VIDEO_FAST_FORWARD, context->playback->Speed) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_FAST_FORWARD: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
if (ioctl(videofd, VIDEO_CONTINUE, NULL) == -1)
|
||||
{
|
||||
linuxdvb_err("VIDEO_CONTINUE: ERROR %d, %s\n", errno, strerror(errno));
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
@@ -525,7 +498,7 @@ int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -536,7 +509,7 @@ int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
@@ -555,7 +528,7 @@ int LinuxDvbAVSync(Context_t *context __attribute__((unused)), char *type __attr
|
||||
*/
|
||||
if (audiofd != -1)
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (ioctl(audiofd, AUDIO_SET_AV_SYNC, 0) == -1) //context->playback->AVSync) == -1)
|
||||
{
|
||||
@@ -563,7 +536,7 @@ int LinuxDvbAVSync(Context_t *context __attribute__((unused)), char *type __attr
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -579,7 +552,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -598,7 +571,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
@@ -659,7 +632,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
@@ -756,7 +729,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
}
|
||||
|
||||
@@ -784,7 +757,7 @@ static int Write(Context_t *context, void *_out)
|
||||
video = !strcmp("video", out->type);
|
||||
audio = !strcmp("audio", out->type);
|
||||
|
||||
linuxdvb_printf(20, "DataLength=%u PrivateLength=%u Pts=%llu FrameRate=%f\n",
|
||||
linuxdvb_printf(20, "DataLength=%u PrivateLength=%u Pts=%" PRIu64 " FrameRate=%d\n",
|
||||
out->len, out->extralen, out->pts, out->frameRate);
|
||||
linuxdvb_printf(20, "v%d a%d\n", video, audio);
|
||||
|
||||
@@ -826,7 +799,7 @@ static int Write(Context_t *context, void *_out)
|
||||
{
|
||||
if (evt.type == VIDEO_EVENT_SIZE_CHANGED)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_SIZE_CHANGED\n", evt.type);
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_SIZE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "width : %d\n", evt.u.size.w);
|
||||
linuxdvb_printf(10, "height : %d\n", evt.u.size.h);
|
||||
linuxdvb_printf(10, "aspect : %d\n", evt.u.size.aspect_ratio);
|
||||
@@ -836,13 +809,13 @@ static int Write(Context_t *context, void *_out)
|
||||
}
|
||||
else if (evt.type == VIDEO_EVENT_FRAME_RATE_CHANGED)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_FRAME_RATE_CHANGED\n", evt.type);
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_FRAME_RATE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "framerate : %d\n", evt.u.frame_rate);
|
||||
videoInfo.frame_rate = evt.u.frame_rate;
|
||||
}
|
||||
else if (evt.type == 16 /*VIDEO_EVENT_PROGRESSIVE_CHANGED*/)
|
||||
{
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_PROGRESSIVE_CHANGED\n", evt.type);
|
||||
linuxdvb_printf(10, "VIDEO_EVENT_PROGRESSIVE_CHANGED type: 0x%x\n", evt.type);
|
||||
linuxdvb_printf(10, "progressive : %d\n", evt.u.frame_rate);
|
||||
videoInfo.progressive = evt.u.frame_rate;
|
||||
context->manager->video->Command(context, MANAGER_UPDATED_TRACK_INFO, NULL);
|
||||
@@ -889,7 +862,7 @@ static int Write(Context_t *context, void *_out)
|
||||
char *Encoding = NULL;
|
||||
context->manager->audio->Command(context, MANAGER_GETENCODING, &Encoding);
|
||||
|
||||
linuxdvb_printf(20, "%s::%s Encoding = %s\n", FILENAME, __FUNCTION__, Encoding);
|
||||
linuxdvb_printf(20, "Encoding = %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
@@ -40,8 +39,10 @@
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include "bcm_ioctls.h"
|
||||
#include "stm_ioctls.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "output.h"
|
||||
#include "writer.h"
|
||||
#include "misc.h"
|
||||
@@ -51,27 +52,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define LINUXDVB_DEBUG
|
||||
#define LINUXDVB_SILENT
|
||||
|
||||
static unsigned short debug_level = 0;
|
||||
|
||||
static const char FILENAME[] = __FILE__;
|
||||
|
||||
#ifdef LINUXDVB_DEBUG
|
||||
#define linuxdvb_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_printf(x...)
|
||||
#endif
|
||||
|
||||
#ifndef LINUXDVB_SILENT
|
||||
#define linuxdvb_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_err(x...)
|
||||
#endif
|
||||
|
||||
|
||||
#define cERR_LINUXDVB_NO_ERROR 0
|
||||
#define cERR_LINUXDVB_ERROR -1
|
||||
|
||||
@@ -113,23 +93,8 @@ int LinuxDvbStop(Context_t *context, char *type);
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
void getLinuxDVBMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused)))
|
||||
{
|
||||
|
||||
linuxdvb_printf(250, "requesting mutex\n");
|
||||
|
||||
pthread_mutex_lock(&LinuxDVBmutex);
|
||||
|
||||
linuxdvb_printf(250, "received mutex\n");
|
||||
}
|
||||
|
||||
void releaseLinuxDVBMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused)))
|
||||
{
|
||||
pthread_mutex_unlock(&LinuxDVBmutex);
|
||||
|
||||
linuxdvb_printf(250, "released mutex\n");
|
||||
|
||||
}
|
||||
#define getLinuxDVBMutex() pthread_mutex_lock(&LinuxDVBmutex)
|
||||
#define releaseLinuxDVBMutex() pthread_mutex_unlock(&LinuxDVBmutex)
|
||||
|
||||
int LinuxDvbOpen(Context_t *context __attribute__((unused)), char *type)
|
||||
{
|
||||
@@ -206,7 +171,7 @@ int LinuxDvbOpen(Context_t *context __attribute__((unused)), char *type)
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_SET_STREAMTYPE: %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffOpen(context, type, audiofd);
|
||||
}
|
||||
@@ -214,7 +179,7 @@ int LinuxDvbOpen(Context_t *context __attribute__((unused)), char *type)
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
int LinuxDvbClose(Context_t *context, char *type)
|
||||
int LinuxDvbClose(Context_t *context, char *type)
|
||||
{
|
||||
uint8_t video = !strcmp("video", type);
|
||||
uint8_t audio = !strcmp("audio", type);
|
||||
@@ -227,7 +192,7 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
*/
|
||||
LinuxDvbStop(context, type);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffClose(context);
|
||||
@@ -237,13 +202,14 @@ int LinuxDvbClose(Context_t *context, char *type)
|
||||
close(videofd);
|
||||
videofd = -1;
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
close(audiofd);
|
||||
audiofd = -1;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
return cERR_LINUXDVB_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -269,7 +235,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, (void *) VIDEO_ENCODING_AUTO) == -1)
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, VIDEO_ENCODING_AUTO) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -279,7 +245,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
else
|
||||
{
|
||||
linuxdvb_printf(20, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, (void *) writer->caps->dvbEncoding) == -1)
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, writer->caps->dvbEncoding) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -295,6 +261,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
}
|
||||
free(Encoding);
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
char *Encoding = NULL;
|
||||
@@ -317,7 +284,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
else
|
||||
{
|
||||
linuxdvb_printf(20, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, (void *) writer->caps->dvbEncoding) == -1)
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, writer->caps->dvbEncoding) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -345,7 +312,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -368,6 +335,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
@@ -390,7 +358,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -403,7 +371,7 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -424,7 +392,7 @@ int LinuxDvbPause(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -455,7 +423,7 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffResume(context);
|
||||
|
||||
@@ -472,7 +440,7 @@ int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int
|
||||
|
||||
linuxdvb_printf(50, "\n");
|
||||
|
||||
if (ioctl(videofd, VIDEO_DISCONTINUITY, (void *) dis_type) == -1)
|
||||
if (ioctl(videofd, VIDEO_DISCONTINUITY, dis_type) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno));
|
||||
@@ -532,7 +500,7 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -552,7 +520,7 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
@@ -572,8 +540,7 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
/* konfetti comment: speed is a value given in skipped frames */
|
||||
|
||||
@@ -584,7 +551,7 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
@@ -612,8 +579,7 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
speedIndex = context->playback->Speed % (sizeof(SpeedList) / sizeof(int));
|
||||
|
||||
@@ -626,13 +592,12 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
speedIndex = context->playback->Speed % (sizeof(SpeedList) / sizeof(int));
|
||||
|
||||
@@ -645,7 +610,7 @@ int LinuxDvbFastForward(Context_t *context, char *type)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
@@ -672,7 +637,7 @@ int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -684,7 +649,7 @@ int LinuxDvbSlowMotion(Context_t *context, char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting with value %d\n", ret);
|
||||
@@ -703,7 +668,7 @@ int LinuxDvbAVSync(Context_t *context, char *type __attribute__((unused)))
|
||||
*/
|
||||
if (audiofd != -1)
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (ioctl(audiofd, AUDIO_SET_AV_SYNC, context->playback->AVSync) == -1)
|
||||
{
|
||||
@@ -712,7 +677,7 @@ int LinuxDvbAVSync(Context_t *context, char *type __attribute__((unused)))
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -728,7 +693,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (video && videofd != -1)
|
||||
{
|
||||
@@ -749,7 +714,7 @@ int LinuxDvbClear(Context_t *context __attribute__((unused)), char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
}
|
||||
|
||||
linuxdvb_printf(10, "exiting\n");
|
||||
@@ -764,7 +729,7 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i
|
||||
linuxdvb_printf(50, "\n");
|
||||
|
||||
// pts is a non writting requests and can be done in parallel to other requests
|
||||
//getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
//getLinuxDVBMutex();
|
||||
|
||||
if (videofd > -1 && !ioctl(videofd, VIDEO_GET_PTS, (void *)&sCURRENT_PTS))
|
||||
{
|
||||
@@ -794,7 +759,7 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i
|
||||
|
||||
*((unsigned long long int *)pts) = (unsigned long long int)sCURRENT_PTS;
|
||||
|
||||
//releaseLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
//releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -806,7 +771,7 @@ int LinuxDvbGetFrameCount(Context_t *context __attribute__((unused)), unsigned l
|
||||
|
||||
linuxdvb_printf(50, "\n");
|
||||
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (videofd != -1)
|
||||
{
|
||||
@@ -836,7 +801,7 @@ int LinuxDvbGetFrameCount(Context_t *context __attribute__((unused)), unsigned l
|
||||
if (ret == cERR_LINUXDVB_NO_ERROR)
|
||||
*((unsigned long long int *)frameCount) = playInfo.frame_count;
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -851,7 +816,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
|
||||
if ((video && videofd != -1) || (audio && audiofd != -1))
|
||||
{
|
||||
getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
getLinuxDVBMutex();
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
@@ -881,7 +846,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, (void *) AUDIO_ENCODING_MP3) == -1)
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, AUDIO_ENCODING_MP3) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -890,7 +855,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
else
|
||||
{
|
||||
linuxdvb_printf(10, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, (void *) writer->caps->dvbEncoding) == -1)
|
||||
if (ioctl(audiofd, AUDIO_SET_ENCODING, writer->caps->dvbEncoding) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("AUDIO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -945,7 +910,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
else
|
||||
{
|
||||
linuxdvb_printf(10, "found writer %s for encoding %s\n", writer->caps->name, Encoding);
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, (void *) writer->caps->dvbEncoding) == -1)
|
||||
if (ioctl(videofd, VIDEO_SET_ENCODING, writer->caps->dvbEncoding) == -1)
|
||||
{
|
||||
linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
linuxdvb_err("VIDEO_SET_ENCODING: %s\n", strerror(errno));
|
||||
@@ -968,7 +933,7 @@ int LinuxDvbSwitch(Context_t *context, char *type)
|
||||
}
|
||||
}
|
||||
|
||||
releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__);
|
||||
releaseLinuxDVBMutex();
|
||||
|
||||
}
|
||||
|
||||
@@ -1188,7 +1153,7 @@ static int reset(Context_t *context)
|
||||
}
|
||||
|
||||
free(Encoding);
|
||||
|
||||
|
||||
if (isBufferedOutput)
|
||||
LinuxDvbBuffFlush(context);
|
||||
|
||||
@@ -1313,7 +1278,7 @@ static int Command(void *_context, OutputCmd_t command, void *argument)
|
||||
ret = cERR_LINUXDVB_ERROR;
|
||||
if (!isBufferedOutput)
|
||||
{
|
||||
uint32_t bufferSize = *((uint32_t*)argument);
|
||||
uint32_t bufferSize = *((uint32_t *)argument);
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
if (bufferSize > 0)
|
||||
{
|
||||
@@ -1326,7 +1291,7 @@ static int Command(void *_context, OutputCmd_t command, void *argument)
|
||||
case OUTPUT_GET_BUFFER_SIZE:
|
||||
{
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
*((uint32_t*)argument) = LinuxDvbBuffGetSize();
|
||||
*((uint32_t *)argument) = LinuxDvbBuffGetSize();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
|
||||
@@ -31,28 +32,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define OUTPUT_DEBUG
|
||||
#else
|
||||
#define OUTPUT_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef OUTPUT_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define output_printf(level, x...) do { \
|
||||
if (debug_level >= level) fprintf(stderr, x); } while (0)
|
||||
#else
|
||||
#define output_printf(level, x...)
|
||||
#endif
|
||||
|
||||
#ifndef OUTPUT_SILENT
|
||||
#define output_err(x...) do { printf(x); } while (0)
|
||||
#else
|
||||
#define output_err(x...)
|
||||
#endif
|
||||
|
||||
/* Error Constants */
|
||||
#define cERR_OUTPUT_NO_ERROR 0
|
||||
#define cERR_OUTPUT_INTERNAL_ERROR -1
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -34,36 +35,13 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "output.h"
|
||||
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//SULGE DEBUG ENABLED
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define SUBTITLE_DEBUG
|
||||
#else
|
||||
#define SUBTITLE_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef SUBTITLE_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define subtitle_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define subtitle_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef SUBTITLE_SILENT
|
||||
#define subtitle_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define subtitle_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* Error Constants */
|
||||
#define cERR_SUBTITLE_NO_ERROR 0
|
||||
#define cERR_SUBTITLE_ERROR -1
|
||||
@@ -226,15 +204,15 @@ static int Write(Context_t *context, void *data)
|
||||
|
||||
if (!strncmp("S_TEXT/SUBRIP", Encoding, 13))
|
||||
{
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, json_string_escape((char *)out->data));
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%" PRId64 ",\"e\":%" PRId64 ",\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, json_string_escape((char *)out->data));
|
||||
}
|
||||
else if (!strncmp("S_TEXT/ASS", Encoding, 10))
|
||||
{
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, ass_get_text((char *)out->data));
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%" PRId64 ",\"e\":%" PRId64 ",\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, ass_get_text((char *)out->data));
|
||||
}
|
||||
else if (!strncmp("D_WEBVTT/SUBTITLES", Encoding, 18))
|
||||
{
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%lld,\"e\":%lld,\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, json_string_escape((char *)out->data));
|
||||
fprintf(stderr, "{\"s_a\":{\"id\":%d,\"s\":%" PRId64 ",\"e\":%" PRId64 ",\"t\":\"%s\"}}\n", out->trackId, out->pts / 90, out->pts / 90 + out->durationMS, json_string_escape((char *)out->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -28,30 +28,13 @@
|
||||
|
||||
#include "misc.h"
|
||||
#include "writer.h"
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define WRITER_DEBUG
|
||||
|
||||
#ifdef WRITER_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define writer_printf(level, x...) do { \
|
||||
if (debug_level >= level) printf(x); } while (0)
|
||||
#else
|
||||
#define writer_printf(level, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WRITER_SILENT
|
||||
#define writer_err(x...) do { printf(x); } while (0)
|
||||
#else
|
||||
#define writer_err(x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -57,30 +58,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define AAC_DEBUG
|
||||
#else
|
||||
#define AAC_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef AAC_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define aac_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define aac_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef AAC_SILENT
|
||||
#define aac_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define aac_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -180,7 +157,7 @@ static int _writeData(WriterAVCallData_t *call, int type)
|
||||
aac_err("parsing Data with missing syncword. ignoring...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// STB can handle only AAC LC profile
|
||||
if (0 == (call->data[2] & 0xC0))
|
||||
{
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -54,24 +55,6 @@
|
||||
/* ***************************** */
|
||||
#define AC3_HEADER_LENGTH 7
|
||||
|
||||
#define AC3_DEBUG
|
||||
|
||||
#ifdef AC3_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define ac3_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define ac3_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef AC3_SILENT
|
||||
#define ac3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define ac3_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -124,7 +107,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
struct iovec iov[3];
|
||||
|
||||
iov[0].iov_base = PesHeader;
|
||||
iov[0].iov_len = InsertPesHeader(PesHeader, call->len, MPEG_AUDIO_PES_START_CODE, call->Pts, 0); //+ sizeof(AC3_SYNC_HEADER)
|
||||
iov[0].iov_len = InsertPesHeader(PesHeader, call->len, MPEG_AUDIO_PES_START_CODE, call->Pts, 0); //+ sizeof(AC3_SYNC_HEADER)
|
||||
|
||||
//PesHeader[6] = 0x81;
|
||||
//PesHeader[7] = 0x80;
|
||||
@@ -135,7 +118,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
iov[1].iov_base = call->data;
|
||||
iov[1].iov_len = call->len;
|
||||
|
||||
ac3_printf(40, "PES HEADER LEN %d\n", iov[0].iov_len);
|
||||
ac3_printf(40, "PES HEADER LEN %d\n", (int)iov[0].iov_len);
|
||||
|
||||
return call->WriteV(call->fd, iov, 2);
|
||||
}
|
||||
|
@@ -39,9 +39,10 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
//#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -52,28 +53,6 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define AMR_DEBUG
|
||||
#else
|
||||
#define AMR_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef AMR_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define amr_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define amr_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef AMR_SILENT
|
||||
#define amr_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define amr_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -56,28 +57,6 @@
|
||||
#define B_GET_BITS(w,e,b) (((w)>>(b))&(((unsigned)(-1))>>((sizeof(unsigned))*8-(e+1-b))))
|
||||
#define B_SET_BITS(name,v,e,b) (((unsigned)(v))<<(b))
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define DIVX_DEBUG
|
||||
#else
|
||||
#define DIVX_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef DIVX_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define divx_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef DIVX_SILENT
|
||||
#define divx_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -58,28 +59,6 @@
|
||||
#define PES_AUDIO_PACKET_SIZE 2028
|
||||
#define SPDIF_AUDIO_PACKET_SIZE (1024 * sizeof(unsigned int) * 2) // stereo 32bit samples.
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define DTS_DEBUG
|
||||
#else
|
||||
#define DTS_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef DTS_DEBUG
|
||||
|
||||
static int16_t debug_level = 0;
|
||||
|
||||
#define dts_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define dts_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef DTS_SILENT
|
||||
#define dts_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define dts_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -52,23 +53,6 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
//#define H263_DEBUG
|
||||
|
||||
#ifdef H263_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define h263_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __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)
|
||||
#else
|
||||
#define h263_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include "stm_ioctls.h"
|
||||
#include "bcm_ioctls.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -55,23 +56,6 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
#define H264_SILENT
|
||||
//#define H264_DEBUG
|
||||
#ifdef H264_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define h264_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef H264_SILENT
|
||||
#define h264_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
#define IOVEC_SIZE 128
|
||||
|
||||
|
@@ -55,23 +55,6 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
#define H264_SILENT
|
||||
//#define H265_DEBUG
|
||||
#ifdef H265_DEBUG
|
||||
|
||||
static short debug_level = 10;
|
||||
|
||||
#define h264_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef H265_SILENT
|
||||
#define h264_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
#define IOVEC_SIZE 128
|
||||
|
||||
@@ -99,14 +82,14 @@ static unsigned int CodecDataLen = 0;
|
||||
|
||||
static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigned int *NalLength)
|
||||
{
|
||||
h264_printf(10, "H265 check codec data..!\n");
|
||||
h265_printf(10, "H265 check codec data..!\n");
|
||||
int32_t ret = -100;
|
||||
if (data)
|
||||
{
|
||||
unsigned char tmp[2048];
|
||||
unsigned int tmp_len = 0;
|
||||
|
||||
h264_printf(10, "H265 have codec data..!");
|
||||
h265_printf(10, "H265 have codec data..!");
|
||||
|
||||
if (cd_len > 3 && (data[0] || data[1] || data[2] > 1))
|
||||
{
|
||||
@@ -115,7 +98,7 @@ static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigne
|
||||
int i;
|
||||
if (data[0] != 0)
|
||||
{
|
||||
h264_printf(10, "Unsupported extra data version %d, decoding may fail", (int)data[0]);
|
||||
h265_printf(10, "Unsupported extra data version %d, decoding may fail", (int)data[0]);
|
||||
}
|
||||
|
||||
*NalLength = (data[21] & 3) + 1;
|
||||
@@ -126,7 +109,7 @@ static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigne
|
||||
int j;
|
||||
if (pos + 3 > cd_len)
|
||||
{
|
||||
h264_printf(10, "Buffer underrun in extra header (%d >= %u)", pos + 3, cd_len);
|
||||
h265_printf(10, "Buffer underrun in extra header (%d >= %u)", pos + 3, cd_len);
|
||||
break;
|
||||
}
|
||||
// ignore flags + NAL type (1 byte)
|
||||
@@ -136,14 +119,14 @@ static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigne
|
||||
{
|
||||
if (pos + 2 > cd_len)
|
||||
{
|
||||
h264_printf(10, "Buffer underrun in extra nal header (%d >= %u)", pos + 2, cd_len);
|
||||
h265_printf(10, "Buffer underrun in extra nal header (%d >= %u)", pos + 2, cd_len);
|
||||
break;
|
||||
}
|
||||
int nal_size = data[pos] << 8 | data[pos + 1];
|
||||
pos += 2;
|
||||
if (pos + nal_size > cd_len)
|
||||
{
|
||||
h264_printf(10, "Buffer underrun in extra nal (%d >= %u)", pos + 2 + nal_size, cd_len);
|
||||
h265_printf(10, "Buffer underrun in extra nal (%d >= %u)", pos + 2 + nal_size, cd_len);
|
||||
break;
|
||||
}
|
||||
memcpy(tmp + tmp_len, "\x00\x00\x00\x01", 4);
|
||||
@@ -183,7 +166,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
unsigned int len = 0;
|
||||
int ic = 0;
|
||||
struct iovec iov[IOVEC_SIZE];
|
||||
h264_printf(20, "\n");
|
||||
h265_printf(20, "\n");
|
||||
|
||||
if (call == NULL)
|
||||
{
|
||||
@@ -198,7 +181,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
if (TimeScale) {}
|
||||
VideoPts = call->Pts;
|
||||
|
||||
h264_printf(20, "VideoPts %lld - %d %d\n", call->Pts, TimeDelta, TimeScale);
|
||||
h265_printf(20, "VideoPts %lld - %d %d\n", call->Pts, TimeDelta, TimeScale);
|
||||
|
||||
if ((call->data == NULL) || (call->len <= 0))
|
||||
{
|
||||
@@ -212,9 +195,9 @@ static int writeData(WriterAVCallData_t *call)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (call->InfoFlags & 0x1) // TS container
|
||||
if (call->InfoFlags & 0x1) // TS container
|
||||
{
|
||||
h264_printf(10, "H265 simple inject method!\n");
|
||||
h265_printf(10, "H265 simple inject method!\n");
|
||||
uint32_t PacketLength = 0;
|
||||
uint32_t FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE;
|
||||
|
||||
@@ -304,7 +287,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
}
|
||||
while ((pos + NalLengthBytes) < call->len);
|
||||
|
||||
h264_printf(10, "<<<< PacketLength [%d]\n", PacketLength);
|
||||
h265_printf(10, "<<<< PacketLength [%d]\n", PacketLength);
|
||||
iov[0].iov_len = InsertPesHeader(PesHeader, -1, MPEG_VIDEO_PES_START_CODE, VideoPts, 0);
|
||||
|
||||
len = call->WriteV(call->fd, iov, ic);
|
||||
@@ -315,7 +298,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
}
|
||||
}
|
||||
|
||||
h264_printf(10, "< len %d\n", len);
|
||||
h265_printf(10, "< len %d\n", len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@@ -58,29 +58,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define LPCM_DEBUG
|
||||
#else
|
||||
#define LPCM_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef LPCM_DEBUG
|
||||
|
||||
static uint16_t debug_level = 1;
|
||||
|
||||
#define lpcm_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define lpcm_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef LPCM_SILENT
|
||||
#define lpcm_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define lpcm_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
#define LLPCM_VOB_HEADER_LEN (6)
|
||||
|
||||
/* ***************************** */
|
||||
|
@@ -52,23 +52,6 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
#define MP3_DEBUG
|
||||
|
||||
#ifdef MP3_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define mp3_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mp3_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef MP3_SILENT
|
||||
#define mp3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mp3_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
|
@@ -53,24 +53,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#define MPEG2_DEBUG
|
||||
|
||||
#ifdef MPEG2_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define mpeg2_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg2_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef MPEG2_SILENT
|
||||
#define mpeg2_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg2_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -53,29 +53,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define MPEG4_DEBUG
|
||||
#else
|
||||
#define MPEG4_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef MPEG4_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define mpeg4_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg4_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef MPEG4_SILENT
|
||||
#define mpeg4_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg4_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -56,28 +56,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define PCM_DEBUG
|
||||
#else
|
||||
#define PCM_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef PCM_DEBUG
|
||||
|
||||
static uint16_t debug_level = 0;
|
||||
|
||||
#define pcm_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define pcm_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef PCM_SILENT
|
||||
#define pcm_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define pcm_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -139,17 +117,6 @@ static int writeData(WriterAVCallData_t *call)
|
||||
|
||||
if (pcmPrivateData->bResampling || NULL == fixed_buffer)
|
||||
{
|
||||
if (0)
|
||||
{
|
||||
printf("ioctl %d", ioctl(call->fd, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
|
||||
printf("ioctl %d", ioctl(call->fd, AUDIO_PAUSE));
|
||||
printf("ioctl %d", ioctl(call->fd, AUDIO_SET_BYPASS_MODE, 0x30));
|
||||
printf("ioctl %d", ioctl(call->fd, AUDIO_PLAY));
|
||||
printf("ioctl %d", ioctl(call->fd, AUDIO_CONTINUE));
|
||||
}
|
||||
|
||||
int32_t format = 0x01;
|
||||
|
||||
int32_t width = 0;
|
||||
int32_t depth = 0;
|
||||
int32_t rate = (uint64_t)pcmPrivateData->sample_rate;
|
||||
@@ -193,6 +160,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
}
|
||||
|
||||
uint8_t *data = codec_data;
|
||||
uint16_t format = LE ? 0x0001 : 0x0100;
|
||||
|
||||
byterate = channels * rate * width / 8;
|
||||
block_align = channels * width / 8;
|
||||
@@ -237,7 +205,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
fixed_bufferfilled = 0;
|
||||
/* avoid compiler warning */
|
||||
if (LE) {}
|
||||
//printf("PCM fixed_buffersize [%u] [%s]\n", fixed_buffersize, LE ? "LE":"BE");
|
||||
pcm_printf(40, "PCM fixed_buffersize [%u] [%s]\n", fixed_buffersize, LE ? "LE" : "BE");
|
||||
}
|
||||
|
||||
while (size > 0)
|
||||
@@ -286,11 +254,6 @@ static int writeData(WriterAVCallData_t *call)
|
||||
iov[1].iov_len = fixed_buffersize;
|
||||
call->WriteV(call->fd, iov, 2);
|
||||
fixed_buffertimestamp += fixed_bufferduration;
|
||||
|
||||
int g_fd_dump = open("/hdd/lpcm/ffmpeg.pes", O_CREAT |
|
||||
O_RDWR | O_APPEND, S_IRUSR | S_IWUSR);
|
||||
call->WriteV(g_fd_dump, iov, 2);
|
||||
close(g_fd_dump);
|
||||
}
|
||||
|
||||
return size;
|
||||
|
@@ -56,30 +56,6 @@
|
||||
#define VC1_SEQUENCE_LAYER_METADATA_START_CODE 0x80
|
||||
#define VC1_FRAME_START_CODE 0x0d
|
||||
|
||||
#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define VC1_DEBUG
|
||||
#else
|
||||
#define VC1_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef VC1_DEBUG
|
||||
|
||||
static short debug_level = 10;
|
||||
|
||||
#define vc1_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vc1_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef VC1_SILENT
|
||||
#define vc1_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vc1_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -53,30 +53,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define VP_DEBUG
|
||||
#else
|
||||
#define VP_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef VP_DEBUG
|
||||
|
||||
static short debug_level = 10;
|
||||
|
||||
#define vp_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vp_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef VP_SILENT
|
||||
#define vp_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vp_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -53,28 +53,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define WMA_DEBUG
|
||||
#else
|
||||
#define WMA_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef WMA_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define wma_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wma_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WMA_SILENT
|
||||
#define wma_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wma_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -55,29 +55,6 @@
|
||||
|
||||
#define WMV_FRAME_START_CODE 0x0d
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define WMV_DEBUG
|
||||
#else
|
||||
#define WMV_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef WMV_DEBUG
|
||||
|
||||
static short debug_level = 10;
|
||||
|
||||
#define wmv_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wmv_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WMV_SILENT
|
||||
#define wmv_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wmv_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -30,29 +30,12 @@
|
||||
#include "misc.h"
|
||||
#include "writer.h"
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#define WRITER_DEBUG
|
||||
|
||||
#ifdef WRITER_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define writer_printf(level, x...) do { \
|
||||
if (debug_level >= level) printf(x); } while (0)
|
||||
#else
|
||||
#define writer_printf(level, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WRITER_SILENT
|
||||
#define writer_err(x...) do { printf(x); } while (0)
|
||||
#else
|
||||
#define writer_err(x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -110,8 +93,8 @@ ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf,
|
||||
int retval = -1;
|
||||
int maxFd = pipefd > fd ? pipefd : fd;
|
||||
struct timeval tv;
|
||||
|
||||
while(size > 0 && 0 == PlaybackDieNow(0) && !context->playback->isSeeking)
|
||||
|
||||
while (size > 0 && 0 == PlaybackDieNow(0) && !context->playback->isSeeking)
|
||||
{
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&wfds);
|
||||
@@ -143,19 +126,19 @@ ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf,
|
||||
// continue;
|
||||
//}
|
||||
|
||||
if(FD_ISSET(pipefd, &rfds))
|
||||
if (FD_ISSET(pipefd, &rfds))
|
||||
{
|
||||
FlushPipe(pipefd);
|
||||
//printf("RETURN FROM SELECT DUE TO pipefd SET\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(FD_ISSET(fd, &wfds))
|
||||
if (FD_ISSET(fd, &wfds))
|
||||
{
|
||||
ret = write(fd, buf, size);
|
||||
if (ret < 0)
|
||||
{
|
||||
switch(errno)
|
||||
switch (errno)
|
||||
{
|
||||
case EINTR:
|
||||
case EAGAIN:
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
@@ -42,7 +41,7 @@
|
||||
|
||||
#include <libavutil/intreadwrite.h>
|
||||
#include "ffmpeg/latmenc.h"
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
@@ -56,30 +55,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
//#define SAM_WITH_DEBUG
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define AAC_DEBUG
|
||||
#else
|
||||
#define AAC_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef AAC_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define aac_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define aac_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef AAC_SILENT
|
||||
#define aac_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define aac_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -181,7 +156,7 @@ static int _writeData(void *_call, int type)
|
||||
aac_err("parsing Data with missing syncword. ignoring...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// STB can handle only AAC LC profile
|
||||
if (0 == (call->data[2] & 0xC0))
|
||||
{
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -52,28 +52,6 @@
|
||||
/* ***************************** */
|
||||
#define AC3_HEADER_LENGTH 7
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define AC3_DEBUG
|
||||
#else
|
||||
#define AC3_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef AC3_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define ac3_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define ac3_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef AC3_SILENT
|
||||
#define ac3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define ac3_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define DIVX_DEBUG
|
||||
#else
|
||||
#define DIVX_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef DIVX_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define divx_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef DIVX_SILENT
|
||||
#define divx_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define DIVX_DEBUG
|
||||
#else
|
||||
#define DIVX_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef DIVX_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define divx_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef DIVX_SILENT
|
||||
#define divx_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define divx_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -56,28 +56,6 @@
|
||||
#define PES_AUDIO_PACKET_SIZE 2028
|
||||
#define SPDIF_AUDIO_PACKET_SIZE (1024 * sizeof(unsigned int) * 2) // stereo 32bit samples.
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define DTS_DEBUG
|
||||
#else
|
||||
#define DTS_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef DTS_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define dts_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define dts_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef DTS_SILENT
|
||||
#define dts_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define dts_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -33,13 +33,13 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define H263_DEBUG
|
||||
#else
|
||||
#define H263_SILENT
|
||||
#endif
|
||||
|
||||
#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, 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, FILENAME, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h263_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
@@ -42,6 +41,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -53,28 +53,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define H264_DEBUG
|
||||
#else
|
||||
#define H264_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef H264_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define h264_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef H264_SILENT
|
||||
#define h264_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define h264_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
#define NALU_TYPE_PLAYER2_CONTAINER_PARAMETERS 24
|
||||
#define CONTAINER_PARAMETERS_VERSION 0x00
|
||||
|
||||
@@ -267,7 +245,7 @@ static int32_t writeData(void *_call)
|
||||
|
||||
iov[ic++].iov_base = PesHeader;
|
||||
initialHeader = 0;
|
||||
if (initialHeader)
|
||||
if (initialHeader)
|
||||
{
|
||||
initialHeader = 0;
|
||||
iov[ic].iov_base = call->private_data;
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define MP3_DEBUG
|
||||
#else
|
||||
#define MP3_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef MP3_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define mp3_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mp3_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef MP3_SILENT
|
||||
#define mp3_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mp3_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -182,3 +160,4 @@ struct Writer_s WriterAudioVORBIS =
|
||||
&writeData,
|
||||
&caps_vorbis
|
||||
};
|
||||
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define MPEG2_DEBUG
|
||||
#else
|
||||
#define MPEG2_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef MPEG2_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define mpeg2_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg2_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef MPEG2_SILENT
|
||||
#define mpeg2_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define mpeg2_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
@@ -42,6 +41,7 @@
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -54,28 +54,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define PCM_DEBUG
|
||||
#else
|
||||
#define PCM_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef PCM_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define pcm_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define pcm_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef PCM_SILENT
|
||||
#define pcm_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define pcm_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -33,12 +33,12 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -61,28 +61,6 @@
|
||||
#define VC1_SEQUENCE_LAYER_METADATA_START_CODE 0x80
|
||||
#define VC1_FRAME_START_CODE 0x0d
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define VC1_DEBUG
|
||||
#else
|
||||
#define VC1_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef VC1_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define vc1_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vc1_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef VC1_SILENT
|
||||
#define vc1_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vc1_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -38,10 +38,10 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
#include "stm_ioctls.h"
|
||||
#include "misc.h"
|
||||
#include "pes.h"
|
||||
#include "writer.h"
|
||||
@@ -50,28 +50,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define VORBIS_DEBUG
|
||||
#else
|
||||
#define VORBIS_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef VORBIS_DEBUG
|
||||
|
||||
static short debug_level = 1;
|
||||
|
||||
#define vorbis_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vorbis_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef VORBIS_SILENT
|
||||
#define vorbis_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define vorbis_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -51,28 +51,6 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define WMA_DEBUG
|
||||
#else
|
||||
#define WMA_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef WMA_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define wma_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wma_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WMA_SILENT
|
||||
#define wma_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wma_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -34,12 +34,12 @@
|
||||
#include <sys/uio.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/stm_ioctls.h>
|
||||
#include <memory.h>
|
||||
#include <asm/types.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "stm_ioctls.h"
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "debug.h"
|
||||
@@ -58,28 +58,6 @@
|
||||
#define METADATA_STRUCT_B_FRAMERATE_START 32
|
||||
#define METADATA_STRUCT_C_START 8
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define WMV_DEBUG
|
||||
#else
|
||||
#define WMV_SILENT
|
||||
#endif
|
||||
|
||||
#ifdef WMV_DEBUG
|
||||
|
||||
static short debug_level = 0;
|
||||
|
||||
#define wmv_printf(level, fmt, x...) do { \
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wmv_printf(level, fmt, x...)
|
||||
#endif
|
||||
|
||||
#ifndef WMV_SILENT
|
||||
#define wmv_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define wmv_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -100,47 +100,47 @@ static Writer_t *AvailableWriter[] =
|
||||
ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf, int size)
|
||||
{
|
||||
fd_set rfds;
|
||||
|
||||
|
||||
ssize_t ret;
|
||||
int retval = -1;
|
||||
struct timeval tv;
|
||||
|
||||
while(size > 0 && 0 == PlaybackDieNow(0) && !context->playback->isSeeking)
|
||||
|
||||
while (size > 0 && 0 == PlaybackDieNow(0) && !context->playback->isSeeking)
|
||||
{
|
||||
if (context->playback->isPaused)
|
||||
{
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(pipefd, &rfds);
|
||||
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 500000; // 500ms
|
||||
|
||||
|
||||
retval = select(pipefd + 1, &rfds, NULL, NULL, &tv);
|
||||
if (retval < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (retval == 0)
|
||||
{
|
||||
//printf("RETURN FROM SELECT DUE TO TIMEOUT TIMEOUT\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(FD_ISSET(pipefd, &rfds))
|
||||
|
||||
if (FD_ISSET(pipefd, &rfds))
|
||||
{
|
||||
FlushPipe(pipefd);
|
||||
//printf("RETURN FROM SELECT DUE TO pipefd SET\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//printf(">> Before Write fd [%d]\n", fd);
|
||||
ret = write(fd, buf, size);
|
||||
//printf(">> After Write ret[%d] size[%d]\n", (int)ret, size);
|
||||
if (ret == size)
|
||||
ret = 0; // no error
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
@@ -199,3 +199,4 @@ Writer_t *getDefaultAudioWriter()
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user