mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-09-01 01:40:59 +02:00
Merge branch 'master' of https://bitbucket.org/max_10/libstb-hal-max
Origin commit data
------------------
Branch: master
Commit: bfedf93ef4
Author: vanhofen <vanhofen@gmx.de>
Date: 2019-02-27 (Wed, 27 Feb 2019)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -97,7 +97,7 @@ int map_volume(const int volume)
|
|||||||
|
|
||||||
int cAudio::setVolume(unsigned int left, unsigned int right)
|
int cAudio::setVolume(unsigned int left, unsigned int right)
|
||||||
{
|
{
|
||||||
hal_debug("%s(%d, %d)\n", __func__, left, right);
|
hal_info("cAudio::%s(%d, %d)\n", __func__, left, right);
|
||||||
|
|
||||||
volume = (left + right) / 2;
|
volume = (left + right) / 2;
|
||||||
int v = map_volume(volume);
|
int v = map_volume(volume);
|
||||||
@@ -199,7 +199,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
|||||||
unsigned int devmask, stereo, usable;
|
unsigned int devmask, stereo, usable;
|
||||||
const char *dsp_dev = getenv("DSP_DEVICE");
|
const char *dsp_dev = getenv("DSP_DEVICE");
|
||||||
const char *mix_dev = getenv("MIX_DEVICE");
|
const char *mix_dev = getenv("MIX_DEVICE");
|
||||||
hal_debug("%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
hal_info("cAudio::%s ch %d srate %d bits %d le %d\n", __FUNCTION__, ch, srate, bits, little_endian);
|
||||||
if (clipfd > -1) {
|
if (clipfd > -1) {
|
||||||
hal_info("%s: clipfd already opened (%d)\n", __func__, clipfd);
|
hal_info("%s: clipfd already opened (%d)\n", __func__, clipfd);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -226,7 +226,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian)
|
|||||||
" fall back to /dev/mixer\n", __func__, dsp_dev);
|
" fall back to /dev/mixer\n", __func__, dsp_dev);
|
||||||
mix_dev = "/dev/mixer";
|
mix_dev = "/dev/mixer";
|
||||||
}
|
}
|
||||||
hal_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
hal_info("cAudio::%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */
|
||||||
/* the tdoss dsp driver seems to work only on the second open(). really. */
|
/* the tdoss dsp driver seems to work only on the second open(). really. */
|
||||||
clipfd = open(dsp_dev, O_WRONLY);
|
clipfd = open(dsp_dev, O_WRONLY);
|
||||||
if (clipfd < 0) {
|
if (clipfd < 0) {
|
||||||
@@ -313,20 +313,19 @@ int cAudio::WriteClip(unsigned char *buffer, int size)
|
|||||||
|
|
||||||
int cAudio::StopClip()
|
int cAudio::StopClip()
|
||||||
{
|
{
|
||||||
hal_debug("%s\n", __FUNCTION__);
|
hal_info("cAudio::%s\n", __FUNCTION__);
|
||||||
#if 0
|
|
||||||
if (clipfd < 0) {
|
if (clipfd < 0) {
|
||||||
hal_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
hal_info("%s: clipfd not yet opened\n", __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(clipfd);
|
close(clipfd);
|
||||||
clipfd = -1;
|
clipfd = -1;
|
||||||
if (mixer_fd >= -1) {
|
if (mixer_fd > -1) {
|
||||||
close(mixer_fd);
|
close(mixer_fd);
|
||||||
mixer_fd = -1;
|
mixer_fd = -1;
|
||||||
}
|
}
|
||||||
setVolume(volume, volume);
|
setVolume(volume, volume);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -276,8 +276,10 @@ AVCodecContext* open_codec(AVMediaType mediaType, AVFormatContext* formatContext
|
|||||||
int image_to_mpeg2(const char *image_name, int fd)
|
int image_to_mpeg2(const char *image_name, int fd)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
|
||||||
av_register_all();
|
av_register_all();
|
||||||
avcodec_register_all();
|
avcodec_register_all();
|
||||||
|
#endif
|
||||||
|
|
||||||
AVFormatContext *formatContext = avformat_alloc_context();
|
AVFormatContext *formatContext = avformat_alloc_context();
|
||||||
if (formatContext && (ret = avformat_open_input(&formatContext, image_name, NULL, NULL)) == 0){
|
if (formatContext && (ret = avformat_open_input(&formatContext, image_name, NULL, NULL)) == 0){
|
||||||
|
@@ -126,7 +126,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab
|
|||||||
static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length);
|
static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length);
|
||||||
static int64_t calcPts(uint32_t avContextIdx, AVStream *stream, int64_t pts);
|
static int64_t calcPts(uint32_t avContextIdx, AVStream *stream, int64_t pts);
|
||||||
static int64_t doCalcPts(int64_t start_time, const AVRational time_base, int64_t pts);
|
static int64_t doCalcPts(int64_t start_time, const AVRational time_base, int64_t pts);
|
||||||
static int32_t container_ffmpeg_stop(Context_t *context);
|
|
||||||
|
|
||||||
/* Progressive playback means that we play local file
|
/* Progressive playback means that we play local file
|
||||||
* but this local file can grows up, for example
|
* but this local file can grows up, for example
|
||||||
@@ -1353,11 +1352,6 @@ static void FFMPEGThread(Context_t *context)
|
|||||||
do_seek_target_seconds = 0;
|
do_seek_target_seconds = 0;
|
||||||
PlaybackDieNow(1);
|
PlaybackDieNow(1);
|
||||||
|
|
||||||
if(context && context->playback)
|
|
||||||
{
|
|
||||||
container_ffmpeg_stop(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
ffmpeg_printf(10, "terminating\n");
|
ffmpeg_printf(10, "terminating\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1540,7 +1534,6 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
|
|||||||
{
|
{
|
||||||
AVIOContext *avio_ctx = NULL;
|
AVIOContext *avio_ctx = NULL;
|
||||||
custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t));
|
custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t));
|
||||||
|
|
||||||
memset(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t));
|
memset(custom_io_tab[AVIdx], 0x00, sizeof(CustomIOCtx_t));
|
||||||
|
|
||||||
custom_io_tab[AVIdx]->szFile = filename;
|
custom_io_tab[AVIdx]->szFile = filename;
|
||||||
@@ -2738,11 +2731,7 @@ static int32_t container_ffmpeg_stop(Context_t *context)
|
|||||||
fclose(io->pFile);
|
fclose(io->pFile);
|
||||||
if (io->pMoovFile)
|
if (io->pMoovFile)
|
||||||
fclose(io->pMoovFile);
|
fclose(io->pMoovFile);
|
||||||
if(custom_io_tab[i] != NULL)
|
free(custom_io_tab[i]);
|
||||||
{
|
|
||||||
free(custom_io_tab[i]);
|
|
||||||
custom_io_tab[i] = NULL;
|
|
||||||
}
|
|
||||||
av_freep(&(avContextTab[i]->pb->buffer));
|
av_freep(&(avContextTab[i]->pb->buffer));
|
||||||
av_freep(&(avContextTab[i]->pb));
|
av_freep(&(avContextTab[i]->pb));
|
||||||
use_custom_io[i] = 0;
|
use_custom_io[i] = 0;
|
||||||
|
@@ -322,7 +322,7 @@ int cAudio::StopClip()
|
|||||||
}
|
}
|
||||||
close(clipfd);
|
close(clipfd);
|
||||||
clipfd = -1;
|
clipfd = -1;
|
||||||
if (mixer_fd >= -1) {
|
if (mixer_fd > -1) {
|
||||||
close(mixer_fd);
|
close(mixer_fd);
|
||||||
mixer_fd = -1;
|
mixer_fd = -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user