mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 15:33:00 +02:00
libeplayer3-arm: Code formatting
This commit is contained in:
@@ -103,8 +103,7 @@ static void update_finish_timeout()
|
||||
/* On some STBs PTS readed from decoder is invalid after seek or at start
|
||||
* this is the reason for additional validation when we what to close immediately
|
||||
*/
|
||||
if (!progressive_playback && 0 == ret && currPts >= maxInjectedPts &&
|
||||
((currPts - maxInjectedPts) / 90000) < 2)
|
||||
if (!progressive_playback && 0 == ret && currPts >= maxInjectedPts && ((currPts - maxInjectedPts) / 90000) < 2)
|
||||
{
|
||||
/* close immediately
|
||||
*/
|
||||
|
@@ -1108,7 +1108,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
printf("{\"log\":\"Frame read error: '%s'\"}\n", errbuf);
|
||||
}
|
||||
/*
|
||||
if( ffmpegStatus == AVERROR(EAGAIN) )
|
||||
if(ffmpegStatus == AVERROR(EAGAIN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1261,8 +1261,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
|
||||
avContextTab[AVIdx]->interrupt_callback.callback = interrupt_cb;
|
||||
avContextTab[AVIdx]->interrupt_callback.opaque = context->playback;
|
||||
#ifdef SAM_CUSTOM_IO
|
||||
if (0 == strstr(filename, "://") ||
|
||||
0 == strncmp(filename, "file://", 7))
|
||||
if (0 == strstr(filename, "://") || 0 == strncmp(filename, "file://", 7))
|
||||
{
|
||||
AVIOContext *avio_ctx = container_ffmpeg_get_avio_context(filename, 4096);
|
||||
if (avio_ctx)
|
||||
@@ -1334,8 +1333,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
|
||||
* unless uri contain param wich can be understandable
|
||||
* only by librtmp
|
||||
*/
|
||||
if (strstr(filename, " token=") ||
|
||||
strstr(filename, " jtv="))
|
||||
if (strstr(filename, " token=") || strstr(filename, " jtv="))
|
||||
{
|
||||
rtmpProtoImplType = RTMP_LIBRTMP;
|
||||
}
|
||||
@@ -1479,8 +1477,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (0 == strncmp(filename, "http://", 7) ||
|
||||
0 == strncmp(filename, "https://", 8))
|
||||
else if (0 == strncmp(filename, "http://", 7) || 0 == strncmp(filename, "https://", 8))
|
||||
{
|
||||
av_dict_set(&avio_opts, "timeout", "20000000", 0); //20sec
|
||||
av_dict_set(&avio_opts, "reconnect", "1", 0);
|
||||
@@ -1532,8 +1529,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
|
||||
if (avContextTab[AVIdx] != NULL && avContextTab[AVIdx]->pb != NULL && !context->playback->isTSLiveMode)
|
||||
{
|
||||
ffmpeg_real_read_org = avContextTab[AVIdx]->pb->read_packet;
|
||||
if (0 == AVIdx && strstr(filename, "://") != 0 &&
|
||||
strncmp(filename, "file://", 7) != 0)
|
||||
if (0 == AVIdx && strstr(filename, "://") != 0 && strncmp(filename, "file://", 7) != 0)
|
||||
{
|
||||
if (ffmpeg_buf_size > 0 && ffmpeg_buf_size > FILLBUFDIFF + FILLBUFPAKET)
|
||||
{
|
||||
@@ -1601,7 +1597,7 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames)
|
||||
avformat_network_init();
|
||||
// SULGE DEBUG ENABLED
|
||||
// make ffmpeg silen
|
||||
// av_log_set_level( AV_LOG_DEBUG );
|
||||
// av_log_set_level(AV_LOG_DEBUG);
|
||||
av_log_set_callback(ffmpeg_silen_callback);
|
||||
context->playback->abortRequested = 0;
|
||||
int32_t res = container_ffmpeg_init_av_context(context, playFilesNames->szFirstFile, 0);
|
||||
@@ -1961,10 +1957,10 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV1
|
||||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV2
|
||||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAPRO
|
||||
|| get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0)
|
||||
else if (get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV1 ||
|
||||
get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAV2 ||
|
||||
get_codecpar(stream)->codec_id == AV_CODEC_ID_WMAPRO ||
|
||||
get_codecpar(stream)->codec_id == AV_CODEC_ID_WMALOSSLESS) //if (get_codecpar(stream)->extradata_size > 0)
|
||||
{
|
||||
ffmpeg_printf(10, "Create WMA ExtraData\n");
|
||||
uint16_t channels = get_codecpar(stream)->channels;
|
||||
@@ -2509,7 +2505,7 @@ static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length)
|
||||
static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg)
|
||||
{
|
||||
ffmpeg_printf(10, "track %d\n", *arg);
|
||||
/* Hellmaster1024: nothing to do here!*/
|
||||
/* Hellmaster1024: nothing to do here! */
|
||||
int64_t sec = -5;
|
||||
context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec);
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
|
4
libeplayer3-arm/external/ffmpeg/get_bits.h
vendored
4
libeplayer3-arm/external/ffmpeg/get_bits.h
vendored
@@ -465,7 +465,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
|
||||
|
||||
#define GET_RL_VLC(level, run, name, gb, table, bits, \
|
||||
max_depth, need_update) \
|
||||
do { \
|
||||
do { \
|
||||
int n, nb_bits; \
|
||||
unsigned int index; \
|
||||
\
|
||||
@@ -498,7 +498,7 @@ do { \
|
||||
} \
|
||||
run = table[index].run; \
|
||||
SKIP_BITS(name, gb, n); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
static inline int decode012(GetBitContext *gb)
|
||||
{
|
||||
|
2
libeplayer3-arm/external/ffmpeg/mathops.h
vendored
2
libeplayer3-arm/external/ffmpeg/mathops.h
vendored
@@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef NEG_SSR32
|
||||
# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
|
||||
# define NEG_SSR32(a,s) (((int32_t)(a))>>(32-(s)))
|
||||
#endif
|
||||
|
||||
#ifndef sign_extend
|
||||
|
@@ -36,8 +36,7 @@ void avpriv_align_put_bits(PutBitContext *s)
|
||||
put_bits(s, s->bit_left & 7, 0);
|
||||
}
|
||||
|
||||
void avpriv_put_string(PutBitContext *pb, const char *string,
|
||||
int terminate_string)
|
||||
void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string)
|
||||
{
|
||||
while (*string)
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
|
||||
#include<stdint.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "container.h"
|
||||
#include "output.h"
|
||||
|
@@ -86,7 +86,6 @@ typedef struct TrackDescription_s
|
||||
int32_t aspect_ratio_num;
|
||||
int32_t aspect_ratio_den;
|
||||
int progressive;
|
||||
|
||||
} TrackDescription_t;
|
||||
|
||||
typedef struct Manager_s
|
||||
@@ -94,7 +93,6 @@ typedef struct Manager_s
|
||||
char *Name;
|
||||
int (* Command)(/*Context_t*/void *, ManagerCmd_t, void *);
|
||||
char **Capabilities;
|
||||
|
||||
} Manager_t;
|
||||
|
||||
typedef struct ManagerHandler_s
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define OUTPUT_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -69,7 +70,6 @@ typedef struct Output_s
|
||||
int32_t (* Command)(/*Context_t*/void *, OutputCmd_t, void *);
|
||||
int32_t (* Write)(/*Context_t*/void *, void *privateData);
|
||||
char **Capabilities;
|
||||
|
||||
} Output_t;
|
||||
|
||||
extern Output_t LinuxDvbOutput;
|
||||
|
@@ -3,7 +3,28 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT, PLAYBACK_METADATA} PlaybackCmd_t;
|
||||
typedef enum {
|
||||
PLAYBACK_OPEN,
|
||||
PLAYBACK_CLOSE,
|
||||
PLAYBACK_PLAY,
|
||||
PLAYBACK_STOP,
|
||||
PLAYBACK_PAUSE,
|
||||
PLAYBACK_CONTINUE,
|
||||
PLAYBACK_FLUSH,
|
||||
PLAYBACK_TERM,
|
||||
PLAYBACK_FASTFORWARD,
|
||||
PLAYBACK_SEEK,
|
||||
PLAYBACK_SEEK_ABS,
|
||||
PLAYBACK_PTS,
|
||||
PLAYBACK_LENGTH,
|
||||
PLAYBACK_SWITCH_AUDIO,
|
||||
PLAYBACK_SWITCH_SUBTITLE,
|
||||
PLAYBACK_INFO,
|
||||
PLAYBACK_SLOWMOTION,
|
||||
PLAYBACK_FASTBACKWARD,
|
||||
PLAYBACK_GET_FRAME_COUNT,
|
||||
PLAYBACK_METADATA
|
||||
} PlaybackCmd_t;
|
||||
|
||||
typedef struct PlaybackHandler_s
|
||||
{
|
||||
|
@@ -119,8 +119,7 @@ static void *TermThreadFun(void *arg)
|
||||
FD_SET(g_pfd[0], &readfds);
|
||||
FD_SET(fd, &readfds);
|
||||
nfds = fd > g_pfd[0] ? fd + 1 : g_pfd[0] + 1;
|
||||
while (select(nfds, &readfds, NULL, NULL, NULL) == -1
|
||||
&& errno == EINTR)
|
||||
while (select(nfds, &readfds, NULL, NULL, NULL) == -1 && errno == EINTR)
|
||||
{
|
||||
/* Restart if interrupted by signal */
|
||||
continue;
|
||||
@@ -128,7 +127,7 @@ static void *TermThreadFun(void *arg)
|
||||
if (FD_ISSET(fd, &readfds))
|
||||
{
|
||||
/*
|
||||
if ( (cl = accept(fd, NULL, NULL)) == -1)
|
||||
if ((cl = accept(fd, NULL, NULL)) == -1)
|
||||
{
|
||||
perror("TermThreadFun accept error");
|
||||
goto finish;
|
||||
@@ -475,6 +474,7 @@ static int HandleTracks(const Manager_t *ptrManager, const PlaybackCmd_t playbac
|
||||
return commandRetVal;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void UpdateVideoTrack()
|
||||
{
|
||||
HandleTracks(g_player->manager->video, (PlaybackCmd_t) - 1, "vc");
|
||||
|
@@ -430,7 +430,7 @@ int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int
|
||||
int ret = cERR_LINUXDVB_NO_ERROR;
|
||||
// int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus;
|
||||
// linuxdvb_printf(50, "\n");
|
||||
// if (ioctl( videofd, VIDEO_DISCONTINUITY, (void*) dis_type) == -1)
|
||||
// if (ioctl(videofd, VIDEO_DISCONTINUITY, (void*) dis_type) == -1)
|
||||
// {
|
||||
// linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
// linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno));
|
||||
@@ -479,7 +479,7 @@ int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type)
|
||||
// unsigned char video = !strcmp("video", type);
|
||||
// unsigned char audio = !strcmp("audio", type);
|
||||
// linuxdvb_printf(10, "v%d a%d\n", video, audio);
|
||||
// if ( (video && videofd != -1) || (audio && audiofd != -1) ) {
|
||||
// if ((video && videofd != -1) || (audio && audiofd != -1)) {
|
||||
// getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__);
|
||||
// if (video && videofd != -1) {
|
||||
// if (ioctl(videofd, VIDEO_FLUSH, NULL) == -1)
|
||||
@@ -727,7 +727,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_BYPASS_MODE, (void*) AUDIO_ENCODING_MP3) == -1)
|
||||
// if (ioctl(audiofd, AUDIO_SET_BYPASS_MODE, (void*) AUDIO_ENCODING_MP3) == -1)
|
||||
// {
|
||||
// linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
// linuxdvb_err("AUDIO_SET_BYPASS_MODE: %s\n", strerror(errno));
|
||||
@@ -775,7 +775,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( videofd, VIDEO_SET_STREAMTYPE, (void*) VIDEO_ENCODING_AUTO) == -1)
|
||||
// if (ioctl(videofd, VIDEO_SET_STREAMTYPE, (void*) VIDEO_ENCODING_AUTO) == -1)
|
||||
// {
|
||||
// linuxdvb_err("ioctl failed with errno %d\n", errno);
|
||||
// linuxdvb_err("VIDEO_SET_STREAMTYPE: %s\n", strerror(errno));
|
||||
|
@@ -59,7 +59,7 @@ 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)
|
||||
if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
|
||||
#else
|
||||
#define linuxdvb_printf(x...)
|
||||
#endif
|
||||
|
@@ -106,6 +106,7 @@ static uint8_t brcm_divx311_sequence_header[] =
|
||||
/* ***************************** */
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
static int reset()
|
||||
{
|
||||
initialHeader = 1;
|
||||
|
@@ -69,6 +69,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x);
|
||||
#else
|
||||
#define h263_err(fmt, x...)
|
||||
#endif
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
|
@@ -266,8 +266,7 @@ static int32_t writeData(void *_call)
|
||||
iov[1].iov_len = fixed_buffersize;
|
||||
writev_with_retry(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);
|
||||
int g_fd_dump = open("/hdd/lpcm/ffmpeg.pes", O_CREAT | O_RDWR | O_APPEND, S_IRUSR | S_IWUSR);
|
||||
writev_with_retry(g_fd_dump, iov, 2);
|
||||
close(g_fd_dump);
|
||||
}
|
||||
|
@@ -100,6 +100,7 @@ static video_codec_data_t videocodecdata = {0, 0};
|
||||
/* ***************************** */
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
static int reset()
|
||||
{
|
||||
initialHeader = 1;
|
||||
@@ -153,8 +154,8 @@ static int writeData(void *_call)
|
||||
}
|
||||
}
|
||||
uint8_t needFrameStartCode = 0;
|
||||
if (sizeof(Vc1FrameStartCode) >= call->len
|
||||
|| memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
|
||||
if (sizeof(Vc1FrameStartCode) >= call->len ||
|
||||
memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
|
||||
{
|
||||
needFrameStartCode = 1;
|
||||
PacketLength += sizeof(Vc1FrameStartCode);
|
||||
|
@@ -98,6 +98,7 @@ static video_codec_data_t videocodecdata = {0, 0};
|
||||
/* ***************************** */
|
||||
/* MISC Functions */
|
||||
/* ***************************** */
|
||||
|
||||
static int reset()
|
||||
{
|
||||
initialHeader = 1;
|
||||
@@ -159,8 +160,8 @@ static int writeData(void *_call)
|
||||
}
|
||||
}
|
||||
uint8_t needFrameStartCode = 0;
|
||||
if (sizeof(Vc1FrameStartCode) >= call->len
|
||||
|| memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
|
||||
if (sizeof(Vc1FrameStartCode) >= call->len ||
|
||||
memcmp(call->data, Vc1FrameStartCode, sizeof(Vc1FrameStartCode)) != 0)
|
||||
{
|
||||
needFrameStartCode = 1;
|
||||
PacketLength += sizeof(Vc1FrameStartCode);
|
||||
|
@@ -99,6 +99,7 @@ static Writer_t *AvailableWriter[] =
|
||||
/* ***************************** */
|
||||
/* Functions */
|
||||
/* ***************************** */
|
||||
|
||||
ssize_t write_with_retry(int fd, const void *buf, size_t size)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
@@ -52,6 +52,7 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#ifdef SAM_WITH_DEBUG
|
||||
#define H264_DEBUG
|
||||
#else
|
||||
|
@@ -103,7 +103,7 @@ static const unsigned char Metadata[] =
|
||||
};
|
||||
|
||||
/* ***************************** */
|
||||
/* Varaibles */
|
||||
/* Variables */
|
||||
/* ***************************** */
|
||||
|
||||
static int initialHeader = 1;
|
||||
|
@@ -207,8 +207,7 @@ static int writeData(void *_call)
|
||||
{
|
||||
unsigned int PesLength;
|
||||
unsigned int PrivateHeaderLength;
|
||||
PrivateHeaderLength = InsertVideoPrivateDataHeader(&PesHeader[HeaderLength],
|
||||
call->len);
|
||||
PrivateHeaderLength = InsertVideoPrivateDataHeader(&PesHeader[HeaderLength], call->len);
|
||||
/* Update PesLength */
|
||||
PesLength = PesHeader[PES_LENGTH_BYTE_0] +
|
||||
(PesHeader[PES_LENGTH_BYTE_1] << 8) + PrivateHeaderLength;
|
||||
|
@@ -175,9 +175,9 @@ static int PlaybackOpen(Context_t *context, PlayFiles_t *pFiles)
|
||||
return cERR_PLAYBACK_ERROR;
|
||||
}
|
||||
pFiles->szFirstFile = context->playback->uri;
|
||||
if ((context->container->Command(context, CONTAINER_ADD, extension) < 0)
|
||||
|| (!context->container->selectedContainer)
|
||||
|| (context->container->selectedContainer->Command(context, CONTAINER_INIT, pFiles) < 0))
|
||||
if ((context->container->Command(context, CONTAINER_ADD, extension) < 0) ||
|
||||
(!context->container->selectedContainer) ||
|
||||
(context->container->selectedContainer->Command(context, CONTAINER_INIT, pFiles) < 0))
|
||||
{
|
||||
playback_err("CONTAINER_ADD failed\n");
|
||||
return cERR_PLAYBACK_ERROR;
|
||||
@@ -440,7 +440,8 @@ static int PlaybackFastBackward(Context_t *context, int *speed)
|
||||
int32_t ret = cERR_PLAYBACK_NO_ERROR;
|
||||
playback_printf(10, "speed = %d\n", *speed);
|
||||
/* Audio only reverse play not supported */
|
||||
if (context->playback->isVideo && !context->playback->isForwarding && (!context->playback->isPaused || context->playback->isPlaying))
|
||||
if (context->playback->isVideo && !context->playback->isForwarding &&
|
||||
(!context->playback->isPaused || context->playback->isPlaying))
|
||||
{
|
||||
if ((*speed > 0) || (*speed < cMaxSpeed_fr))
|
||||
{
|
||||
|
Reference in New Issue
Block a user