Refactoring debug code

Conflicts:
	libeplayer3-arm/container/container_ffmpeg.c
This commit is contained in:
samsamsam
2019-01-11 18:57:06 +01:00
committed by Thilo Graf
parent 99844a02dd
commit f58a34e220
53 changed files with 1404 additions and 1398 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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