libeplayer3: add hal_debug

Origin commit data
------------------
Branch: master
Commit: 43c00c43fa
Author: max_10 <max_10@gmx.de>
Date: 2024-03-24 (Sun, 24 Mar 2024)

Origin message was:
------------------
- libeplayer3: add hal_debug

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
max_10
2024-03-24 22:23:52 +01:00
committed by vanhofen
parent ff8a6fa984
commit a254f89bcb
11 changed files with 294 additions and 126 deletions

View File

@@ -6,6 +6,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <string.h> #include <string.h>
#include "config.h"
int cnxt_debug = 0; /* compat, unused */ int cnxt_debug = 0; /* compat, unused */
@@ -22,9 +23,13 @@ static const char *hal_facility[] =
"init ", "init ",
"ca ", "ca ",
"record", "record",
"player",
NULL NULL
}; };
#ifdef __cplusplus
extern "C" {
#endif
void _hal_info(int facility, const void *func, const char *fmt, ...) void _hal_info(int facility, const void *func, const char *fmt, ...)
{ {
/* %p does print "(nil)" instead of 0x00000000 for NULL */ /* %p does print "(nil)" instead of 0x00000000 for NULL */
@@ -50,6 +55,9 @@ void _hal_debug(int facility, const void *func, const char *fmt, ...)
vfprintf(stderr, fmt, args); vfprintf(stderr, fmt, args);
va_end(args); va_end(args);
} }
#ifdef __cplusplus
}
#endif
void hal_debug_init(void) void hal_debug_init(void)
{ {

View File

@@ -9,12 +9,19 @@
#define HAL_DEBUG_INIT 5 #define HAL_DEBUG_INIT 5
#define HAL_DEBUG_CA 6 #define HAL_DEBUG_CA 6
#define HAL_DEBUG_RECORD 7 #define HAL_DEBUG_RECORD 7
#define HAL_DEBUG_ALL ((1<<8)-1) #define HAL_DEBUG_PLAYER 8
#define HAL_DEBUG_ALL ((1<<9)-1)
extern int debuglevel; extern int debuglevel;
#ifdef __cplusplus
extern "C" {
#endif
void _hal_debug(int facility, const void *, const char *fmt, ...) __attribute__((format(printf, 3, 4))); void _hal_debug(int facility, const void *, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
void _hal_info(int facility, const void *, const char *fmt, ...) __attribute__((format(printf, 3, 4))); void _hal_info(int facility, const void *, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
#ifdef __cplusplus
}
#endif
void hal_debug_init(void); void hal_debug_init(void);
void hal_set_threadname(const char *name); void hal_set_threadname(const char *name);

View File

@@ -36,7 +36,7 @@ static void printContainerCapabilities()
int32_t i = 0; int32_t i = 0;
int32_t j = 0; int32_t j = 0;
container_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); container_printf(10, "\n");
container_printf(10, "Capabilities: "); container_printf(10, "Capabilities: ");
for (i = 0; AvailableContainer[i] != NULL; i++) for (i = 0; AvailableContainer[i] != NULL; i++)
@@ -55,7 +55,7 @@ static int32_t selectContainer(Context_t *context, char *extension)
int32_t j = 0; int32_t j = 0;
int32_t ret = -1; int32_t ret = -1;
container_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); container_printf(10, "\n");
for (i = 0; AvailableContainer[i] != NULL; i++) for (i = 0; AvailableContainer[i] != NULL; i++)
{ {
@@ -89,7 +89,7 @@ static int Command(Context_t *context, ContainerCmd_t command, void *argument __
{ {
int ret = 0; int ret = 0;
container_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); container_printf(10, "\n");
switch (command) switch (command)
{ {
@@ -109,7 +109,7 @@ static int Command(Context_t *context, ContainerCmd_t command, void *argument __
break; break;
} }
default: default:
container_err("%s::%s ContainerCmd %d not supported!\n", __FILE__, __FUNCTION__, command); container_err("ContainerCmd %d not supported!\n", command);
break; break;
} }

View File

@@ -29,6 +29,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@@ -41,7 +42,6 @@
#include <sys/poll.h> #include <sys/poll.h>
#include <pthread.h> #include <pthread.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <stdint.h>
#include <ffmpeg/mpeg4audio.h> #include <ffmpeg/mpeg4audio.h>
@@ -764,12 +764,6 @@ static void FFMPEGThread(Context_t *context)
} }
} }
reset_finish_timeout(); reset_finish_timeout();
/*
if (bufferSize > 0)
{
context->output->Command(context, OUTPUT_CLEAR, NULL);
}
*/
} }
else else
{ {
@@ -1035,6 +1029,7 @@ static void FFMPEGThread(Context_t *context)
pcmExtradata.bit_rate = get_codecpar(audioTrack->stream)->bit_rate; pcmExtradata.bit_rate = get_codecpar(audioTrack->stream)->bit_rate;
pcmExtradata.block_align = get_codecpar(audioTrack->stream)->block_align; pcmExtradata.block_align = get_codecpar(audioTrack->stream)->block_align;
pcmExtradata.frame_size = get_codecpar(audioTrack->stream)->frame_size; pcmExtradata.frame_size = get_codecpar(audioTrack->stream)->frame_size;
pcmExtradata.codec_id = get_codecpar(audioTrack->stream)->codec_id; pcmExtradata.codec_id = get_codecpar(audioTrack->stream)->codec_id;
pcmExtradata.bResampling = restart_audio_resampling; pcmExtradata.bResampling = restart_audio_resampling;
@@ -1297,8 +1292,10 @@ static void FFMPEGThread(Context_t *context)
avOut.width = 0; avOut.width = 0;
avOut.height = 0; avOut.height = 0;
avOut.type = "audio"; avOut.type = "audio";
pcmExtradata.private_data = pAudioExtradata; pcmExtradata.private_data = pAudioExtradata;
pcmExtradata.private_size = audioExtradataSize; pcmExtradata.private_size = audioExtradataSize;
if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut, pts) < 0) if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut, pts) < 0)
{ {
ffmpeg_err("writing data to audio device failed\n"); ffmpeg_err("writing data to audio device failed\n");
@@ -1492,7 +1489,7 @@ int SAM_ReadFunc(void *ptr, uint8_t *buffer, int lSize)
{ {
ret = (int)fread((void *) buffer, (size_t) 1, (size_t) lSize, io->pFile); ret = (int)fread((void *) buffer, (size_t) 1, (size_t) lSize, io->pFile);
#if (LIBAVFORMAT_VERSION_MAJOR > 58) || ((LIBAVFORMAT_VERSION_MAJOR == 58) && (LIBAVFORMAT_VERSION_MINOR > 79)) #if (LIBAVFORMAT_VERSION_MAJOR > 58) || ((LIBAVFORMAT_VERSION_MAJOR == 58) && (LIBAVFORMAT_VERSION_MINOR > 79))
if(ret==0) if (ret==0)
ret = AVERROR_EOF; ret = AVERROR_EOF;
#endif #endif
} }
@@ -2492,11 +2489,13 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
if (off >= 0 && chan_config == 0) // channel config must be send in the inband PCE if (off >= 0 && chan_config == 0) // channel config must be send in the inband PCE
{ {
track.aacbuf = malloc(AAC_HEADER_LENGTH + MAX_PCE_SIZE); track.aacbuf = malloc(AAC_HEADER_LENGTH + MAX_PCE_SIZE);
GetBitContext gb; GetBitContext gb;
PutBitContext pb; PutBitContext pb;
init_put_bits(&pb, track.aacbuf + AAC_HEADER_LENGTH, MAX_PCE_SIZE); init_put_bits(&pb, track.aacbuf + AAC_HEADER_LENGTH, MAX_PCE_SIZE);
init_get_bits8(&gb, get_codecpar(stream)->extradata, get_codecpar(stream)->extradata_size); init_get_bits8(&gb, get_codecpar(stream)->extradata, get_codecpar(stream)->extradata_size);
skip_bits_long(&gb, off + 3); skip_bits_long(&gb, off + 3);
put_bits(&pb, 3, 5); //ID_PCE put_bits(&pb, 3, 5); //ID_PCE
track.aacbuflen = AAC_HEADER_LENGTH + (avpriv_copy_pce_data(&pb, &gb) + 3) / 8; track.aacbuflen = AAC_HEADER_LENGTH + (avpriv_copy_pce_data(&pb, &gb) + 3) / 8;
flush_put_bits(&pb); flush_put_bits(&pb);
@@ -2509,6 +2508,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
// https://wiki.multimedia.cx/index.php/ADTS // https://wiki.multimedia.cx/index.php/ADTS
object_type -= 1; //ADTS - profile, the MPEG-4 Audio Object Type minus 1 object_type -= 1; //ADTS - profile, the MPEG-4 Audio Object Type minus 1
track.aacbuf[0] = 0xFF; track.aacbuf[0] = 0xFF;
track.aacbuf[1] = 0xF1; track.aacbuf[1] = 0xF1;
//track.aacbuf[1] |=0x8; //track.aacbuf[1] |=0x8;
@@ -2537,6 +2537,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0) get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0)
{ {
ffmpeg_printf(10, "Create WMA ExtraData\n"); ffmpeg_printf(10, "Create WMA ExtraData\n");
// type_specific_data // type_specific_data
uint16_t codec_id = 0; uint16_t codec_id = 0;
switch (get_codecpar(stream)->codec_id) switch (get_codecpar(stream)->codec_id)
@@ -2625,10 +2626,10 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
memcpy(track.aacbuf + 96, get_codecpar(stream)->extradata, get_codecpar(stream)->extradata_size); memcpy(track.aacbuf + 96, get_codecpar(stream)->extradata, get_codecpar(stream)->extradata_size);
ffmpeg_printf(1, "aacbuf:\n"); ffmpeg_printf(1, "aacbuf:\n");
track.have_aacheader = 1; track.have_aacheader = 1;
} }
#endif #endif
if (context->manager->audio) if (context->manager->audio)
{ {
ffmpeg_printf(1, "cAVIdx[%d]: MANAGER_ADD track AUDIO\n", cAVIdx); ffmpeg_printf(1, "cAVIdx[%d]: MANAGER_ADD track AUDIO\n", cAVIdx);

View File

@@ -87,6 +87,7 @@ void encode_I_mb(BW *bw, MICROBLOCK *mb, int escape_type);
void encode_P_mb(BW *bw, MICROBLOCK *mb, int escape_type); void encode_P_mb(BW *bw, MICROBLOCK *mb, int escape_type);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static const uint16 rl_inter_vlc[103][2] = static const uint16 rl_inter_vlc[103][2] =
{ {
{ 0x2, 2 }, { 0xf, 4 }, { 0x15, 6 }, { 0x17, 7 }, { 0x2, 2 }, { 0xf, 4 }, { 0x15, 6 }, { 0x17, 7 },

View File

@@ -1,19 +1,34 @@
#ifndef __DEBUG_H__
#define __DEBUG_H__
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "hal_debug.h"
#define hal_debug(args...) _hal_debug(HAL_DEBUG_PLAYER, NULL, args)
#define hal_info(args...) _hal_info(HAL_DEBUG_PLAYER, NULL, args)
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define log_error(fmt, x...) do { printf("[%s:%s] " fmt, __FILENAME__, __FUNCTION__, ## x); } while (0) #define log_error(fmt, x...) do { hal_info("[%s:%s] " fmt, __FILENAME__, __FUNCTION__, ## x); } while (0)
#define log_printf(maxlevel, level, fmt, x...) do { if (maxlevel >= level) printf("[%s:%s] " fmt, __FILENAME__, __FUNCTION__, ## x); } while (0) #define log_printf(maxlevel, level, fmt, x...) do { if (maxlevel >= level) hal_info("[%s:%s] " fmt, __FILENAME__, __FUNCTION__, ## x); } while (0)
#define log_debug(maxlevel, level, fmt, x...) do { if (maxlevel >= level) hal_debug("[%s:%s] " fmt, __FILENAME__, __FUNCTION__, ## x); } while (0)
#define FFMPEG_DEBUG_ALL 10
/******************************************* /*******************************************
* ffmpeg * ffmpeg
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define FFMPEG_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define FFMPEG_DEBUG_LEVEL 0 #define FFMPEG_DEBUG_LEVEL 0
#endif
#define FFMPEG_SILENT #define FFMPEG_SILENT
#if FFMPEG_DEBUG_LEVEL #if FFMPEG_DEBUG_LEVEL
#define ffmpeg_printf(...) log_printf(FFMPEG_DEBUG_LEVEL, __VA_ARGS__) #define ffmpeg_printf(...) log_debug(FFMPEG_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define ffmpeg_printf(...) #define ffmpeg_printf(...)
#endif #endif
@@ -27,11 +42,15 @@
/******************************************* /*******************************************
* container * container
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define CONTAINER_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define CONTAINER_DEBUG_LEVEL 0 #define CONTAINER_DEBUG_LEVEL 0
#endif
#define CONTAINER_SILENT #define CONTAINER_SILENT
#if CONTAINER_DEBUG_LEVEL #if CONTAINER_DEBUG_LEVEL
#define container_printf(...) log_printf(CONTAINER_DEBUG_LEVEL, __VA_ARGS__) #define container_printf(...) log_debug(CONTAINER_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define container_printf(...) #define container_printf(...)
#endif #endif
@@ -45,11 +64,15 @@
/******************************************* /*******************************************
* latmenc * latmenc
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define LATMENC_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define LATMENC_DEBUG_LEVEL 0 #define LATMENC_DEBUG_LEVEL 0
#endif
#define LATMENC_SILENT #define LATMENC_SILENT
#if LATMENC_DEBUG_LEVEL #if LATMENC_DEBUG_LEVEL
#define latmenc_printf(...) log_printf(LATMENC_DEBUG_LEVEL, __VA_ARGS__) #define latmenc_printf(...) log_debug(LATMENC_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define latmenc_printf(...) #define latmenc_printf(...)
#endif #endif
@@ -63,11 +86,15 @@
/******************************************* /*******************************************
* audio_mgr * audio_mgr
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define AUDIO_MGR_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define AUDIO_MGR_DEBUG_LEVEL 0 #define AUDIO_MGR_DEBUG_LEVEL 0
#endif
#define AUDIO_MGR_SILENT #define AUDIO_MGR_SILENT
#if AUDIO_MGR_DEBUG_LEVEL #if AUDIO_MGR_DEBUG_LEVEL
#define audio_mgr_printf(...) log_printf(AUDIO_MGR_DEBUG_LEVEL, __VA_ARGS__) #define audio_mgr_printf(...) log_debug(AUDIO_MGR_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define audio_mgr_printf(...) #define audio_mgr_printf(...)
#endif #endif
@@ -78,14 +105,40 @@
#define audio_mgr_err(...) #define audio_mgr_err(...)
#endif #endif
/*******************************************
* chapter_mgr
*******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define CHAPTER_MGR_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define CHAPTER_MGR_DEBUG_LEVEL 0
#endif
#define CHAPTER_MGR_SILENT
#if CHAPTER_MGR_DEBUG_LEVEL
#define chapter_mgr_printf(...) log_debug(CHAPTER_MGR_DEBUG_LEVEL, __VA_ARGS__)
#else
#define chapter_mgr_printf(...)
#endif
#ifndef CHAPTER_MGR_SILENT
#define chapter_mgr_err(...) log_error(__VA_ARGS__)
#else
#define chapter_mgr_err(...)
#endif
/******************************************* /*******************************************
* subtitle_mgr * subtitle_mgr
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define SUBTITLE_MGR_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define SUBTITLE_MGR_DEBUG_LEVEL 0 #define SUBTITLE_MGR_DEBUG_LEVEL 0
#endif
#define SUBTITLE_MGR_SILENT #define SUBTITLE_MGR_SILENT
#if SUBTITLE_MGR_DEBUG_LEVEL #if SUBTITLE_MGR_DEBUG_LEVEL
#define subtitle_mgr_printf(...) log_printf(SUBTITLE_MGR_DEBUG_LEVEL, __VA_ARGS__) #define subtitle_mgr_printf(...) log_debug(SUBTITLE_MGR_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define subtitle_mgr_printf(...) #define subtitle_mgr_printf(...)
#endif #endif
@@ -99,11 +152,15 @@
/******************************************* /*******************************************
* video_mgr * video_mgr
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define VIDEO_MGR_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define VIDEO_MGR_DEBUG_LEVEL 0 #define VIDEO_MGR_DEBUG_LEVEL 0
#endif
#define VIDEO_MGR_SILENT #define VIDEO_MGR_SILENT
#if VIDEO_MGR_DEBUG_LEVEL #if VIDEO_MGR_DEBUG_LEVEL
#define video_mgr_printf(...) log_printf(VIDEO_MGR_DEBUG_LEVEL, __VA_ARGS__) #define video_mgr_printf(...) log_debug(VIDEO_MGR_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define video_mgr_printf(...) #define video_mgr_printf(...)
#endif #endif
@@ -117,11 +174,15 @@
/******************************************* /*******************************************
* linuxdvb * linuxdvb
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define LINUXDVB_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define LINUXDVB_DEBUG_LEVEL 0 #define LINUXDVB_DEBUG_LEVEL 0
#endif
#define LINUXDVB_SILENT #define LINUXDVB_SILENT
#if LINUXDVB_DEBUG_LEVEL #if LINUXDVB_DEBUG_LEVEL
#define linuxdvb_printf(...) log_printf(LINUXDVB_DEBUG_LEVEL, __VA_ARGS__) #define linuxdvb_printf(...) log_debug(LINUXDVB_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define linuxdvb_printf(...) #define linuxdvb_printf(...)
#endif #endif
@@ -135,11 +196,15 @@
/******************************************* /*******************************************
* buff * buff
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define BUFF_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define BUFF_DEBUG_LEVEL 0 #define BUFF_DEBUG_LEVEL 0
#endif
#define BUFF_SILENT #define BUFF_SILENT
#if BUFF_DEBUG_LEVEL #if BUFF_DEBUG_LEVEL
#define buff_printf(...) log_printf(BUFF_DEBUG_LEVEL, __VA_ARGS__) #define buff_printf(...) log_debug(BUFF_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define buff_printf(...) #define buff_printf(...)
#endif #endif
@@ -153,11 +218,15 @@
/******************************************* /*******************************************
* output * output
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define OUTPUT_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define OUTPUT_DEBUG_LEVEL 0 #define OUTPUT_DEBUG_LEVEL 0
#endif
#define OUTPUT_SILENT #define OUTPUT_SILENT
#if OUTPUT_DEBUG_LEVEL #if OUTPUT_DEBUG_LEVEL
#define output_printf(...) log_printf(OUTPUT_DEBUG_LEVEL, __VA_ARGS__) #define output_printf(...) log_debug(OUTPUT_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define output_printf(...) #define output_printf(...)
#endif #endif
@@ -171,11 +240,15 @@
/******************************************* /*******************************************
* subtitle * subtitle
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define SUBTITLE_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define SUBTITLE_DEBUG_LEVEL 0 #define SUBTITLE_DEBUG_LEVEL 0
#endif
#define SUBTITLE_SILENT #define SUBTITLE_SILENT
#if SUBTITLE_DEBUG_LEVEL #if SUBTITLE_DEBUG_LEVEL
#define subtitle_printf(...) log_printf(SUBTITLE_DEBUG_LEVEL, __VA_ARGS__) #define subtitle_printf(...) log_debug(SUBTITLE_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define subtitle_printf(...) #define subtitle_printf(...)
#endif #endif
@@ -189,11 +262,15 @@
/******************************************* /*******************************************
* writer * writer
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define WRITER_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define WRITER_DEBUG_LEVEL 0 #define WRITER_DEBUG_LEVEL 0
#endif
#define WRITER_SILENT #define WRITER_SILENT
#if WRITER_DEBUG_LEVEL #if WRITER_DEBUG_LEVEL
#define writer_printf(...) log_printf(WRITER_DEBUG_LEVEL, __VA_ARGS__) #define writer_printf(...) log_debug(WRITER_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define writer_printf(...) #define writer_printf(...)
#endif #endif
@@ -207,11 +284,15 @@
/******************************************* /*******************************************
* playback * playback
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define PLAYBACK_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define PLAYBACK_DEBUG_LEVEL 0 #define PLAYBACK_DEBUG_LEVEL 0
#endif
#define PLAYBACK_SILENT #define PLAYBACK_SILENT
#if PLAYBACK_DEBUG_LEVEL #if PLAYBACK_DEBUG_LEVEL
#define playback_printf(...) log_printf(PLAYBACK_DEBUG_LEVEL, __VA_ARGS__) #define playback_printf(...) log_debug(PLAYBACK_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define playback_printf(...) #define playback_printf(...)
#endif #endif
@@ -225,11 +306,15 @@
/******************************************* /*******************************************
* aac * aac
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define AAC_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define AAC_DEBUG_LEVEL 0 #define AAC_DEBUG_LEVEL 0
#endif
#define AAC_SILENT #define AAC_SILENT
#if AAC_DEBUG_LEVEL #if AAC_DEBUG_LEVEL
#define aac_printf(...) log_printf(AAC_DEBUG_LEVEL, __VA_ARGS__) #define aac_printf(...) log_debug(AAC_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define aac_printf(...) #define aac_printf(...)
#endif #endif
@@ -243,11 +328,15 @@
/******************************************* /*******************************************
* ac3 * ac3
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define AC3_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define AC3_DEBUG_LEVEL 0 #define AC3_DEBUG_LEVEL 0
#endif
#define AC3_SILENT #define AC3_SILENT
#if AC3_DEBUG_LEVEL #if AC3_DEBUG_LEVEL
#define ac3_printf(...) log_printf(AC3_DEBUG_LEVEL, __VA_ARGS__) #define ac3_printf(...) log_debug(AC3_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define ac3_printf(...) #define ac3_printf(...)
#endif #endif
@@ -261,11 +350,15 @@
/******************************************* /*******************************************
* amr * amr
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define AMR_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define AMR_DEBUG_LEVEL 0 #define AMR_DEBUG_LEVEL 0
#endif
#define AMR_SILENT #define AMR_SILENT
#if AMR_DEBUG_LEVEL #if AMR_DEBUG_LEVEL
#define amr_printf(...) log_printf(AMR_DEBUG_LEVEL, __VA_ARGS__) #define amr_printf(...) log_debug(AMR_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define amr_printf(...) #define amr_printf(...)
#endif #endif
@@ -279,11 +372,15 @@
/******************************************* /*******************************************
* divx * divx
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define DIVX_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define DIVX_DEBUG_LEVEL 0 #define DIVX_DEBUG_LEVEL 0
#endif
#define DIVX_SILENT #define DIVX_SILENT
#if DIVX_DEBUG_LEVEL #if DIVX_DEBUG_LEVEL
#define divx_printf(...) log_printf(DIVX_DEBUG_LEVEL, __VA_ARGS__) #define divx_printf(...) log_debug(DIVX_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define divx_printf(...) #define divx_printf(...)
#endif #endif
@@ -297,11 +394,15 @@
/******************************************* /*******************************************
* dts * dts
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define DTS_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define DTS_DEBUG_LEVEL 0 #define DTS_DEBUG_LEVEL 0
#endif
#define DTS_SILENT #define DTS_SILENT
#if DTS_DEBUG_LEVEL #if DTS_DEBUG_LEVEL
#define dts_printf(...) log_printf(DTS_DEBUG_LEVEL, __VA_ARGS__) #define dts_printf(...) log_debug(DTS_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define dts_printf(...) #define dts_printf(...)
#endif #endif
@@ -315,11 +416,15 @@
/******************************************* /*******************************************
* h263 * h263
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define H263_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define H263_DEBUG_LEVEL 0 #define H263_DEBUG_LEVEL 0
#endif
#define H263_SILENT #define H263_SILENT
#if H263_DEBUG_LEVEL #if H263_DEBUG_LEVEL
#define h263_printf(...) log_printf(H263_DEBUG_LEVEL, __VA_ARGS__) #define h263_printf(...) log_debug(H263_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define h263_printf(...) #define h263_printf(...)
#endif #endif
@@ -333,11 +438,15 @@
/******************************************* /*******************************************
* h264 * h264
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define H264_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define H264_DEBUG_LEVEL 0 #define H264_DEBUG_LEVEL 0
#endif
#define H264_SILENT #define H264_SILENT
#if H264_DEBUG_LEVEL #if H264_DEBUG_LEVEL
#define h264_printf(...) log_printf(H264_DEBUG_LEVEL, __VA_ARGS__) #define h264_printf(...) log_debug(H264_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define h264_printf(...) #define h264_printf(...)
#endif #endif
@@ -351,11 +460,15 @@
/******************************************* /*******************************************
* h265 * h265
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define H265_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define H265_DEBUG_LEVEL 0 #define H265_DEBUG_LEVEL 0
#endif
#define H265_SILENT #define H265_SILENT
#if H265_DEBUG_LEVEL #if H265_DEBUG_LEVEL
#define h265_printf(...) log_printf(H265_DEBUG_LEVEL, __VA_ARGS__) #define h265_printf(...) log_debug(H265_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define h265_printf(...) #define h265_printf(...)
#endif #endif
@@ -369,11 +482,15 @@
/******************************************* /*******************************************
* lpcm * lpcm
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define LPCM_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define LPCM_DEBUG_LEVEL 0 #define LPCM_DEBUG_LEVEL 0
#endif
#define LPCM_SILENT #define LPCM_SILENT
#if LPCM_DEBUG_LEVEL #if LPCM_DEBUG_LEVEL
#define lpcm_printf(...) log_printf(LPCM_DEBUG_LEVEL, __VA_ARGS__) #define lpcm_printf(...) log_debug(LPCM_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define lpcm_printf(...) #define lpcm_printf(...)
#endif #endif
@@ -387,11 +504,15 @@
/******************************************* /*******************************************
* mp3 * mp3
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define MP3_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define MP3_DEBUG_LEVEL 0 #define MP3_DEBUG_LEVEL 0
#endif
#define MP3_SILENT #define MP3_SILENT
#if MP3_DEBUG_LEVEL #if MP3_DEBUG_LEVEL
#define mp3_printf(...) log_printf(MP3_DEBUG_LEVEL, __VA_ARGS__) #define mp3_printf(...) log_debug(MP3_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define mp3_printf(...) #define mp3_printf(...)
#endif #endif
@@ -405,11 +526,15 @@
/******************************************* /*******************************************
* mpeg2 * mpeg2
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define MPEG2_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define MPEG2_DEBUG_LEVEL 0 #define MPEG2_DEBUG_LEVEL 0
#endif
#define MPEG2_SILENT #define MPEG2_SILENT
#if MPEG2_DEBUG_LEVEL #if MPEG2_DEBUG_LEVEL
#define mpeg2_printf(...) log_printf(MPEG2_DEBUG_LEVEL, __VA_ARGS__) #define mpeg2_printf(...) log_debug(MPEG2_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define mpeg2_printf(...) #define mpeg2_printf(...)
#endif #endif
@@ -423,11 +548,15 @@
/******************************************* /*******************************************
* mpeg4 * mpeg4
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define MPEG4_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define MPEG4_DEBUG_LEVEL 0 #define MPEG4_DEBUG_LEVEL 0
#endif
#define MPEG4_SILENT #define MPEG4_SILENT
#if MPEG4_DEBUG_LEVEL #if MPEG4_DEBUG_LEVEL
#define mpeg4_printf(...) log_printf(MPEG4_DEBUG_LEVEL, __VA_ARGS__) #define mpeg4_printf(...) log_debug(MPEG4_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define mpeg4_printf(...) #define mpeg4_printf(...)
#endif #endif
@@ -441,11 +570,15 @@
/******************************************* /*******************************************
* pcm * pcm
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define PCM_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define PCM_DEBUG_LEVEL 0 #define PCM_DEBUG_LEVEL 0
#endif
#define PCM_SILENT #define PCM_SILENT
#if PCM_DEBUG_LEVEL #if PCM_DEBUG_LEVEL
#define pcm_printf(...) log_printf(PCM_DEBUG_LEVEL, __VA_ARGS__) #define pcm_printf(...) log_debug(PCM_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define pcm_printf(...) #define pcm_printf(...)
#endif #endif
@@ -459,11 +592,15 @@
/******************************************* /*******************************************
* vc1 * vc1
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define VC1_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define VC1_DEBUG_LEVEL 0 #define VC1_DEBUG_LEVEL 0
#endif
#define VC1_SILENT #define VC1_SILENT
#if VC1_DEBUG_LEVEL #if VC1_DEBUG_LEVEL
#define vc1_printf(...) log_printf(VC1_DEBUG_LEVEL, __VA_ARGS__) #define vc1_printf(...) log_debug(VC1_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define vc1_printf(...) #define vc1_printf(...)
#endif #endif
@@ -477,11 +614,15 @@
/******************************************* /*******************************************
* vp * vp
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define VP_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define VP_DEBUG_LEVEL 0 #define VP_DEBUG_LEVEL 0
#endif
#define VP_SILENT #define VP_SILENT
#if VP_DEBUG_LEVEL #if VP_DEBUG_LEVEL
#define vp_printf(...) log_printf(VP_DEBUG_LEVEL, __VA_ARGS__) #define vp_printf(...) log_debug(VP_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define vp_printf(...) #define vp_printf(...)
#endif #endif
@@ -495,11 +636,15 @@
/******************************************* /*******************************************
* wma * wma
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define WMA_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define WMA_DEBUG_LEVEL 0 #define WMA_DEBUG_LEVEL 0
#endif
#define WMA_SILENT #define WMA_SILENT
#if WMA_DEBUG_LEVEL #if WMA_DEBUG_LEVEL
#define wma_printf(...) log_printf(WMA_DEBUG_LEVEL, __VA_ARGS__) #define wma_printf(...) log_debug(WMA_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define wma_printf(...) #define wma_printf(...)
#endif #endif
@@ -513,11 +658,15 @@
/******************************************* /*******************************************
* wmv * wmv
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define WMV_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define WMV_DEBUG_LEVEL 0 #define WMV_DEBUG_LEVEL 0
#endif
#define WMV_SILENT #define WMV_SILENT
#if WMV_DEBUG_LEVEL #if WMV_DEBUG_LEVEL
#define wmv_printf(...) log_printf(WMV_DEBUG_LEVEL, __VA_ARGS__) #define wmv_printf(...) log_debug(WMV_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define wmv_printf(...) #define wmv_printf(...)
#endif #endif
@@ -531,11 +680,15 @@
/******************************************* /*******************************************
* mjpeg * mjpeg
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define MJPEG_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define MJPEG_DEBUG_LEVEL 0 #define MJPEG_DEBUG_LEVEL 0
#endif
#define MJPEG_SILENT #define MJPEG_SILENT
#if MJPEG_DEBUG_LEVEL #if MJPEG_DEBUG_LEVEL
#define mjpeg_printf(...) log_printf(MJPEG_DEBUG_LEVEL, __VA_ARGS__) #define mjpeg_printf(...) log_debug(MJPEG_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define mjpeg_printf(...) #define mjpeg_printf(...)
#endif #endif
@@ -549,11 +702,15 @@
/******************************************* /*******************************************
* bcma * bcma
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define BCMA_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define BCMA_DEBUG_LEVEL 0 #define BCMA_DEBUG_LEVEL 0
#endif
#define BCMA_SILENT #define BCMA_SILENT
#if BCMA_DEBUG_LEVEL #if BCMA_DEBUG_LEVEL
#define bcma_printf(...) log_printf(BCMA_DEBUG_LEVEL, __VA_ARGS__) #define bcma_printf(...) log_debug(BCMA_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define bcma_printf(...) #define bcma_printf(...)
#endif #endif
@@ -567,11 +724,15 @@
/******************************************* /*******************************************
* plugin * plugin
*******************************************/ *******************************************/
#if FFMPEG_DEBUG_ALL > 0
#define PLUGIN_DEBUG_LEVEL FFMPEG_DEBUG_ALL
#else
#define PLUGIN_DEBUG_LEVEL 0 #define PLUGIN_DEBUG_LEVEL 0
#endif
#define PLUGIN_SILENT #define PLUGIN_SILENT
#if PLUGIN_DEBUG_LEVEL #if PLUGIN_DEBUG_LEVEL
#define plugin_printf(...) log_printf(PLUGIN_DEBUG_LEVEL, __VA_ARGS__) #define plugin_printf(...) log_debug(PLUGIN_DEBUG_LEVEL, __VA_ARGS__)
#else #else
#define plugin_printf(...) #define plugin_printf(...)
#endif #endif
@@ -581,3 +742,5 @@
#else #else
#define plugin_err(...) #define plugin_err(...)
#endif #endif
#endif

View File

@@ -61,7 +61,7 @@ static int CurrentTrack = 0; //TRACK[0] as default.
static int ManagerAdd(Context_t *context, Track_t track) static int ManagerAdd(Context_t *context, Track_t track)
{ {
audio_mgr_printf(10, "%s::%s name=\"%s\" encoding=\"%s\" id=%d\n", __FILE__, __FUNCTION__, track.Name, track.Encoding, track.Id); audio_mgr_printf(10, "name=\"%s\" encoding=\"%s\" id=%d\n", track.Name, track.Encoding, track.Id);
if (Tracks == NULL) if (Tracks == NULL)
{ {
@@ -75,7 +75,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
if (Tracks == NULL) if (Tracks == NULL)
{ {
audio_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__); audio_mgr_err("malloc failed\n");
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
@@ -101,7 +101,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
} }
else else
{ {
audio_mgr_err("%s::%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP); audio_mgr_err("TrackCount out if range %d - %d\n", TrackCount, TRACKWRAP);
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
@@ -110,7 +110,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
context->playback->isAudio = 1; context->playback->isAudio = 1;
} }
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); audio_mgr_printf(10, "\n");
return cERR_AUDIO_MGR_NO_ERROR; return cERR_AUDIO_MGR_NO_ERROR;
} }
@@ -120,7 +120,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
int i = 0, j = 0; int i = 0, j = 0;
char **tracklist = NULL; char **tracklist = NULL;
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); audio_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -128,7 +128,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
if (tracklist == NULL) if (tracklist == NULL)
{ {
audio_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__); audio_mgr_err("malloc failed\n");
return NULL; return NULL;
} }
@@ -148,7 +148,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
tracklist[j] = NULL; tracklist[j] = NULL;
} }
audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount); audio_mgr_printf(10, "return %p (%d - %d)\n", tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
@@ -157,7 +157,7 @@ static int ManagerDel(Context_t *context)
{ {
int i = 0; int i = 0;
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); audio_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -171,7 +171,7 @@ static int ManagerDel(Context_t *context)
} }
else else
{ {
audio_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__); audio_mgr_err("nothing to delete!\n");
return cERR_AUDIO_MGR_ERROR; return cERR_AUDIO_MGR_ERROR;
} }
@@ -179,7 +179,7 @@ static int ManagerDel(Context_t *context)
CurrentTrack = 0; CurrentTrack = 0;
context->playback->isAudio = 0; context->playback->isAudio = 0;
audio_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__); audio_mgr_printf(10, "return no error\n");
return cERR_AUDIO_MGR_NO_ERROR; return cERR_AUDIO_MGR_NO_ERROR;
} }
@@ -188,7 +188,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int ret = cERR_AUDIO_MGR_NO_ERROR; int ret = cERR_AUDIO_MGR_NO_ERROR;
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); audio_mgr_printf(10, "\n");
switch (command) switch (command)
{ {
@@ -217,7 +217,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET: case MANAGER_GET:
{ {
audio_mgr_printf(20, "%s::%s MANAGER_GET\n", __FILE__, __FUNCTION__); audio_mgr_printf(20, "MANAGER_GET\n");
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
@@ -251,7 +251,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET_TRACK: case MANAGER_GET_TRACK:
{ {
audio_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", __FILE__, __FUNCTION__); audio_mgr_printf(20, "MANAGER_GET_TRACK\n");
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
@@ -265,7 +265,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GETENCODING: case MANAGER_GETENCODING:
{ {
if ((TrackCount > 0) && (CurrentTrack >= 0) && (Tracks[CurrentTrack].Encoding != NULL)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
*((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Encoding); *((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Encoding);
} }
@@ -277,7 +277,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GETNAME: case MANAGER_GETNAME:
{ {
if ((TrackCount > 0) && (CurrentTrack >= 0) && (Tracks[CurrentTrack].Name != NULL)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
*((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Name); *((char **)argument) = (char *)strdup(Tracks[CurrentTrack].Name);
} }
@@ -290,7 +290,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
case MANAGER_SET: case MANAGER_SET:
{ {
int i; int i;
audio_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", __FILE__, __FUNCTION__, *((int *)argument)); audio_mgr_printf(20, "MANAGER_SET id=%d\n", *((int *)argument));
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
{ {
@@ -303,7 +303,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
if (i == TrackCount) if (i == TrackCount)
{ {
audio_mgr_err("%s::%s track id %d unknown\n", __FILE__, __FUNCTION__, *((int *)argument)); audio_mgr_err("track id %d unknown\n", *((int *)argument));
ret = cERR_AUDIO_MGR_ERROR; ret = cERR_AUDIO_MGR_ERROR;
} }
break; break;
@@ -323,12 +323,12 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
break; break;
} }
default: default:
audio_mgr_err("%s::%s ContainerCmd %d not supported!\n", __FILE__, __FUNCTION__, command); audio_mgr_err("ContainerCmd %d not supported!\n", command);
ret = cERR_AUDIO_MGR_ERROR; ret = cERR_AUDIO_MGR_ERROR;
break; break;
} }
audio_mgr_printf(10, "%s::%s returning %d\n", __FILE__, __FUNCTION__, ret); audio_mgr_printf(10, "returning %d\n", ret);
return ret; return ret;
} }

View File

@@ -26,36 +26,18 @@
#include "manager.h" #include "manager.h"
#include "common.h" #include "common.h"
#include "debug.h"
/* ***************************** */ /* ***************************** */
/* Makros/Constants */ /* Makros/Constants */
/* ***************************** */ /* ***************************** */
#define TRACKWRAP 64
#define CHAPTER_MGR_DEBUG #define TRACKWRAP 20
#ifdef CHAPTER_MGR_DEBUG
static short debug_level = 0;
#define chapter_mgr_printf(level, x...) do { \
if (debug_level >= level) printf(x); } while (0)
#else
#define chapter_mgr_printf(level, x...)
#endif
#ifndef CHAPTER_MGR_SILENT
#define chapter_mgr_err(x...) do { printf(x); } while (0)
#else
#define chapter_mgr_err(x...)
#endif
/* Error Constants */ /* Error Constants */
#define cERR_CHAPTER_MGR_NO_ERROR 0 #define cERR_CHAPTER_MGR_NO_ERROR 0
#define cERR_CHAPTER_MGR_ERROR -1 #define cERR_CHAPTER_MGR_ERROR -1
static const char FILENAME[] = __FILE__;
/* ***************************** */ /* ***************************** */
/* Types */ /* Types */
/* ***************************** */ /* ***************************** */
@@ -78,19 +60,21 @@ static int CurrentTrack = 0; //TRACK[0] as default.
static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track) static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
{ {
chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "name=\"%s\" encoding=\"%s\" id=%d\n", track.Name, track.Encoding, track.Id);
if (Tracks == NULL) if (Tracks == NULL)
{ {
Tracks = malloc(sizeof(Track_t) * TRACKWRAP); Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
int i; int i;
for (i = 0; i < TRACKWRAP; i++) for (i = 0; i < TRACKWRAP; i++)
{
Tracks[i].Id = -1; Tracks[i].Id = -1;
}
} }
if (Tracks == NULL) if (Tracks == NULL)
{ {
chapter_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); chapter_mgr_err("malloc failed\n");
return cERR_CHAPTER_MGR_ERROR; return cERR_CHAPTER_MGR_ERROR;
} }
@@ -112,11 +96,11 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
} }
else else
{ {
chapter_mgr_err("%s:%s TrackCount out if range %d - %d\n", FILENAME, __FUNCTION__, TrackCount, TRACKWRAP); chapter_mgr_err("TrackCount out if range %d - %d\n", TrackCount, TRACKWRAP);
return cERR_CHAPTER_MGR_ERROR; return cERR_CHAPTER_MGR_ERROR;
} }
chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "\n");
return cERR_CHAPTER_MGR_NO_ERROR; return cERR_CHAPTER_MGR_NO_ERROR;
} }
@@ -126,23 +110,25 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
int i = 0, j = 0; int i = 0, j = 0;
char **tracklist = NULL; char **tracklist = NULL;
chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1)); tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1));
if (tracklist == NULL) if (tracklist == NULL)
{ {
chapter_mgr_err("%s:%s malloc failed\n", FILENAME, __FUNCTION__); chapter_mgr_err("malloc failed\n");
return NULL; return NULL;
} }
for (i = 0, j = 0; i < TrackCount; i++, j += 2) for (i = 0, j = 0; i < TrackCount; i++, j += 2)
{ {
if (Tracks[i].pending) if (Tracks[i].pending)
{
continue; continue;
}
char tmp[20]; char tmp[20];
snprintf(tmp, sizeof(tmp), "%d", (int)Tracks[i].chapter_start); snprintf(tmp, sizeof(tmp), "%d", (int)Tracks[i].chapter_start);
tracklist[j] = strdup(tmp); tracklist[j] = strdup(tmp);
@@ -151,7 +137,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
tracklist[j] = NULL; tracklist[j] = NULL;
} }
chapter_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, __FUNCTION__, tracklist, j, TrackCount); chapter_mgr_printf(10, "return %p (%d - %d)\n", tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
@@ -160,7 +146,7 @@ static int ManagerDel(Context_t *context __attribute__((unused)))
{ {
int i = 0; int i = 0;
chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -173,14 +159,14 @@ static int ManagerDel(Context_t *context __attribute__((unused)))
} }
else else
{ {
chapter_mgr_err("%s::%s nothing to delete!\n", FILENAME, __FUNCTION__); chapter_mgr_err("nothing to delete!\n");
return cERR_CHAPTER_MGR_ERROR; return cERR_CHAPTER_MGR_ERROR;
} }
TrackCount = 0; TrackCount = 0;
CurrentTrack = 0; CurrentTrack = 0;
chapter_mgr_printf(10, "%s::%s return no error\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "return no error\n");
return cERR_CHAPTER_MGR_NO_ERROR; return cERR_CHAPTER_MGR_NO_ERROR;
} }
@@ -189,7 +175,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int ret = cERR_CHAPTER_MGR_NO_ERROR; int ret = cERR_CHAPTER_MGR_NO_ERROR;
chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); chapter_mgr_printf(10, "\n");
switch (command) switch (command)
{ {
@@ -214,16 +200,18 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int i; int i;
for (i = 0; i < TrackCount; i++) for (i = 0; i < TrackCount; i++)
{
Tracks[i].pending = 1; Tracks[i].pending = 1;
}
break; break;
} }
default: default:
chapter_mgr_err("%s::%s ContainerCmd %d not supported!\n", FILENAME, __FUNCTION__, command); chapter_mgr_err("ContainerCmd %d not supported!\n", command);
ret = cERR_CHAPTER_MGR_ERROR; ret = cERR_CHAPTER_MGR_ERROR;
break; break;
} }
chapter_mgr_printf(10, "%s:%s: returning %d\n", FILENAME, __FUNCTION__, ret); chapter_mgr_printf(10, "returning %d\n", ret);
return ret; return ret;
} }

View File

@@ -60,7 +60,7 @@ static int CurrentTrack = -1; //no as default.
static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track) static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
{ {
subtitle_mgr_printf(10, "%s::%s %s %s %d\n", __FILE__, __FUNCTION__, track.Name, track.Encoding, track.Id); subtitle_mgr_printf(10, "%s %s %d\n", track.Name, track.Encoding, track.Id);
if (Tracks == NULL) if (Tracks == NULL)
{ {
@@ -74,7 +74,7 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
if (Tracks == NULL) if (Tracks == NULL)
{ {
subtitle_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__); subtitle_mgr_err("malloc failed\n");
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
@@ -95,16 +95,16 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
} }
else else
{ {
subtitle_mgr_err("%s::%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP); subtitle_mgr_err("TrackCount out if range %d - %d\n", TrackCount, TRACKWRAP);
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
if (TrackCount > 0) if (TrackCount > 0)
{ {
// context->playback->isSubtitle = 1; context->playback->isSubtitle = 1;
} }
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); subtitle_mgr_printf(10, "\n");
return cERR_SUBTITLE_MGR_NO_ERROR; return cERR_SUBTITLE_MGR_NO_ERROR;
} }
@@ -114,7 +114,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
int i = 0, j = 0; int i = 0, j = 0;
char **tracklist = NULL; char **tracklist = NULL;
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); subtitle_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -122,7 +122,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
if (tracklist == NULL) if (tracklist == NULL)
{ {
subtitle_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__); subtitle_mgr_err("malloc failed\n");
return NULL; return NULL;
} }
@@ -142,7 +142,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
tracklist[j] = NULL; tracklist[j] = NULL;
} }
subtitle_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount); subtitle_mgr_printf(10, "return %p (%d - %d)\n", tracklist, j, TrackCount);
return tracklist; return tracklist;
} }
@@ -151,7 +151,7 @@ static int ManagerDel(Context_t *context __attribute__((unused)))
{ {
int i = 0; int i = 0;
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); subtitle_mgr_printf(10, "\n");
if (Tracks != NULL) if (Tracks != NULL)
{ {
@@ -165,7 +165,7 @@ static int ManagerDel(Context_t *context __attribute__((unused)))
} }
else else
{ {
subtitle_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__); subtitle_mgr_err("nothing to delete!\n");
return cERR_SUBTITLE_MGR_ERROR; return cERR_SUBTITLE_MGR_ERROR;
} }
@@ -173,7 +173,7 @@ static int ManagerDel(Context_t *context __attribute__((unused)))
CurrentTrack = -1; CurrentTrack = -1;
// context->playback->isSubtitle = 0; // context->playback->isSubtitle = 0;
subtitle_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__); subtitle_mgr_printf(10, "return no error\n");
return cERR_SUBTITLE_MGR_NO_ERROR; return cERR_SUBTITLE_MGR_NO_ERROR;
} }
@@ -182,7 +182,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int ret = cERR_SUBTITLE_MGR_NO_ERROR; int ret = cERR_SUBTITLE_MGR_NO_ERROR;
subtitle_mgr_printf(50, "%s::%s %d\n", __FILE__, __FUNCTION__, command); subtitle_mgr_printf(50, "%d\n", command);
switch (command) switch (command)
{ {
@@ -200,7 +200,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET: case MANAGER_GET:
{ {
subtitle_mgr_printf(20, "%s::%s MANAGER_GET\n", FILENAME, __FUNCTION__); subtitle_mgr_printf(20, "MANAGER_GET\n");
if (TrackCount > 0 && CurrentTrack >= 0) if (TrackCount > 0 && CurrentTrack >= 0)
{ {
@@ -234,7 +234,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
} }
case MANAGER_GET_TRACK: case MANAGER_GET_TRACK:
{ {
subtitle_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", FILENAME, __FUNCTION__); subtitle_mgr_printf(20, "MANAGER_GET_TRACK\n");
if ((TrackCount > 0) && (CurrentTrack >= 0)) if ((TrackCount > 0) && (CurrentTrack >= 0))
{ {
@@ -274,7 +274,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
{ {
int i; int i;
subtitle_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", __FILE__, __FUNCTION__, *((int *)argument)); subtitle_mgr_printf(20, "MANAGER_SET id=%d\n", *((int *)argument));
if (*((int *)argument) < 0) if (*((int *)argument) < 0)
{ {
@@ -293,7 +293,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
if (i == TrackCount) if (i == TrackCount)
{ {
subtitle_mgr_err("%s::%s track id %d unknown\n", __FILE__, __FUNCTION__, *((int *)argument)); subtitle_mgr_err("track id %d unknown\n", *((int *)argument));
ret = cERR_SUBTITLE_MGR_ERROR; ret = cERR_SUBTITLE_MGR_ERROR;
} }
break; break;
@@ -313,12 +313,12 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
break; break;
} }
default: default:
subtitle_mgr_err("%s::%s ContainerCmd not supported!", __FILE__, __FUNCTION__); subtitle_mgr_err("ContainerCmd not supported!");
ret = cERR_SUBTITLE_MGR_ERROR; ret = cERR_SUBTITLE_MGR_ERROR;
break; break;
} }
subtitle_mgr_printf(50, "%s::%s returning %d\n", __FILE__, __FUNCTION__, ret); subtitle_mgr_printf(50, "returning %d\n", ret);
return ret; return ret;
} }

View File

@@ -144,7 +144,7 @@ static TrackDescription_t *ManagerList(Context_t *context __attribute__((unused)
tracklist[j].Id = -1; tracklist[j].Id = -1;
} }
video_mgr_printf(10, "return %p (%d - %d)\n", tracklist, j, TrackCount); video_mgr_printf(10, "return %p %d\n", tracklist, TrackCount);
return tracklist; return tracklist;
} }

View File

@@ -63,7 +63,7 @@ static void printOutputCapabilities()
{ {
int i, j; int i, j;
output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); output_printf(10, "\n");
output_printf(10, "Capabilities:\n"); output_printf(10, "Capabilities:\n");
for (i = 0; AvailableOutput[i] != NULL; i++) for (i = 0; AvailableOutput[i] != NULL; i++)
@@ -86,7 +86,7 @@ static void OutputAdd(Context_t *context, char *port)
{ {
int i, j; int i, j;
output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); output_printf(10, "\n");
for (i = 0; AvailableOutput[i] != NULL; i++) for (i = 0; AvailableOutput[i] != NULL; i++)
{ {
@@ -116,7 +116,7 @@ static void OutputAdd(Context_t *context, char *port)
static void OutputDel(Context_t *context, char *port) static void OutputDel(Context_t *context, char *port)
{ {
output_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); output_printf(10, "\n");
if (!strcmp("audio", port)) if (!strcmp("audio", port))
{ {
@@ -136,7 +136,7 @@ static int Command(Context_t *context, OutputCmd_t command, void *argument)
{ {
int ret = cERR_OUTPUT_NO_ERROR; int ret = cERR_OUTPUT_NO_ERROR;
output_printf(10, "%s::%s Command %d\n", __FILE__, __FUNCTION__, command); output_printf(10, "Command %d\n", command);
switch (command) switch (command)
{ {
@@ -584,12 +584,12 @@ static int Command(Context_t *context, OutputCmd_t command, void *argument)
break; break;
} }
default: default:
output_err("%s::%s OutputCmd %d not supported!\n", __FILE__, __FUNCTION__, command); output_err("OutputCmd %d not supported!\n", command);
ret = cERR_OUTPUT_INTERNAL_ERROR; ret = cERR_OUTPUT_INTERNAL_ERROR;
break; break;
} }
output_printf(10, "%s::%s exiting with value %d\n", __FILE__, __FUNCTION__, ret); output_printf(10, "exiting with value %d\n", ret);
return ret; return ret;
} }