libeplayer3-arm: cleanup types, use Context_t in commands

This commit is contained in:
max_10
2018-03-07 23:59:23 +01:00
committed by Thilo Graf
parent 71905680a6
commit cb275626b1
32 changed files with 195 additions and 183 deletions

View File

@@ -98,9 +98,8 @@ static int32_t selectContainer(Context_t *context, char *extension)
return ret;
}
static int Command(void *_context, ContainerCmd_t command, void *argument)
static int Command(Context_t *context, ContainerCmd_t command, void *argument __attribute__((unused)))
{
Context_t *context = (Context_t *) _context;
int ret = 0;
container_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);

View File

@@ -42,12 +42,6 @@
#include <pthread.h>
#include <sys/prctl.h>
#include <libavutil/avutil.h>
#include <libavutil/time.h>
#include <libavformat/avformat.h>
#include <libswresample/swresample.h>
#include <libavutil/opt.h>
#include <ffmpeg/mpeg4audio.h>
#include "common.h"
@@ -56,10 +50,12 @@
#include "aac.h"
#include "pcm.h"
#include "ffmpeg_metadata.h"
/* ***************************** */
/* Makros/Constants */
/* ***************************** */
#if (LIBAVFORMAT_VERSION_MAJOR > 57)
#if (LIBAVFORMAT_VERSION_MAJOR > 56)
#define TS_BYTES_SEEKING 0
#else
#define TS_BYTES_SEEKING 1
@@ -1302,7 +1298,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int
void *opaque = NULL;
const char *protoName = NULL;
uint8_t haveNativeProto = 0;
while (protoName = avio_enum_protocols(&opaque, 1))
while ((protoName = avio_enum_protocols(&opaque, 1)))
{
if (0 == strcmp("rtmp", protoName))
{
@@ -2581,12 +2577,14 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p)
size_t psize = 1;
char **pp;
if (!context) {
if (!context)
{
fprintf(stderr, "BUG %s:%d\n", __func__, __LINE__);
return cERR_CONTAINER_FFMPEG_ERR;
}
if (!p || *p) {
if (!p || *p)
{
fprintf(stderr, "BUG %s:%d\n", __func__, __LINE__);
return cERR_CONTAINER_FFMPEG_ERR;
}
@@ -2602,28 +2600,34 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p)
psize += av_dict_count(((AVStream *)(audioTrack->stream))->metadata);
*p = malloc(sizeof(char *) * psize * 2);
if (!*p) {
if (!*p)
{
fprintf(stderr, "MALLOC %s:%d\n", __func__, __LINE__);
return cERR_CONTAINER_FFMPEG_ERR;
}
pp = *p;
if (avContextTab[0]->metadata)
while ((tag = av_dict_get(avContextTab[0]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
while ((tag = av_dict_get(avContextTab[0]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
{
*pp++ = strdup(tag->key);
*pp++ = strdup(tag->value);
}
if (videoTrack) {
if (videoTrack)
{
tag = NULL;
while ((tag = av_dict_get(((AVStream *)(videoTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
while ((tag = av_dict_get(((AVStream *)(videoTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
{
*pp++ = strdup(tag->key);
*pp++ = strdup(tag->value);
}
}
if (audioTrack) {
if (audioTrack)
{
tag = NULL;
while ((tag = av_dict_get(((AVStream *)(audioTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
while ((tag = av_dict_get(((AVStream *)(audioTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
{
*pp++ = strdup(tag->key);
*pp++ = strdup(tag->value);
}
@@ -2634,9 +2638,8 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p)
return cERR_CONTAINER_FFMPEG_NO_ERROR;
}
static int32_t Command(void *_context, ContainerCmd_t command, void *argument)
static int32_t Command(Context_t *context, ContainerCmd_t command, void *argument)
{
Context_t *context = (Context_t *) _context;
int ret = cERR_CONTAINER_FFMPEG_NO_ERROR;
ffmpeg_printf(50, "Command %d\n", command);
if (command != CONTAINER_SET_BUFFER_SEEK_TIME &&