small fix

Origin commit data
------------------
Branch: master
Commit: aa006562ae
Author: BPanther <bpanther_ts@hotmail.com>
Date: 2024-03-24 (Sun, 24 Mar 2024)


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

------------------
This commit was generated by Migit
This commit is contained in:
BPanther
2024-03-24 22:23:52 +01:00
committed by vanhofen
parent 185d1e9ee7
commit 87b08ccfd3
12 changed files with 65 additions and 69 deletions

View File

@@ -419,7 +419,7 @@ static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extra
{
return "A_IPCM";
}
else if (0 == m4ac.chan_config && STB_HISILICON != GetSTBType())
else if (m4ac.chan_config == 0 && STB_HISILICON != GetSTBType())
{
// according to https://wiki.multimedia.cx/index.php/ADTS
// "MPEG-4 Channel Configuration - in the case of 0, the channel configuration is sent via an inband PCE"
@@ -660,7 +660,7 @@ static void FFMPEGThread(Context_t *context)
/* ST DVB drivers skip data if they are written during pause
* so, we must wait here if there is not buffering queue
*/
if (0 == bufferSize && context->playback->isPaused)
if (bufferSize == 0 && context->playback->isPaused)
{
ffmpeg_printf(20, "paused\n");
reset_finish_timeout();
@@ -905,8 +905,7 @@ static void FFMPEGThread(Context_t *context)
else
#endif
#ifdef HAVE_FLV2MPEG4_CONVERTER
if (get_codecpar(avContextTab[cAVIdx]->streams[packet.stream_index])->codec_id == AV_CODEC_ID_FLV1 &&
0 == memcmp(videoTrack->Encoding, "V_MPEG4", 7))
if (get_codecpar(avContextTab[cAVIdx]->streams[packet.stream_index])->codec_id == AV_CODEC_ID_FLV1 && memcmp(videoTrack->Encoding, "V_MPEG4", 7) == 0)
{
flv2mpeg4_write_packet(context, &flv2mpeg4_context, videoTrack, cAVIdx, &currentVideoPts, &latestPts, &packet);
update_max_injected_pts(latestPts);
@@ -1362,7 +1361,7 @@ static void FFMPEGThread(Context_t *context)
{
static char errbuf[256];
if (0 == av_strerror(ffmpegStatus, errbuf, sizeof(errbuf)))
if (av_strerror(ffmpegStatus, errbuf, sizeof(errbuf)) == 0)
{
/* In this way we inform user about error within the core */
printf("{\"log\":\"Frame read error: '%s'\"}\n", errbuf);
@@ -1397,7 +1396,7 @@ static void FFMPEGThread(Context_t *context)
else if (1 == context->playback->isLoopMode)
{
int64_t tmpLength = 0;
if (0 == container_ffmpeg_get_length(context, &tmpLength) && tmpLength > 0 && get_play_pts() > 0)
if (container_ffmpeg_get_length(context, &tmpLength) == 0 && tmpLength > 0 && get_play_pts() > 0)
{
seek_target_seconds = 0;
do_seek_target_seconds = 1;
@@ -1532,7 +1531,7 @@ int64_t SAM_SeekFunc(void *ptr, int64_t pos, int whence)
if (AVSEEK_SIZE != whence)
{
ret = (int64_t)fseeko(io->pFile, (off_t)pos, whence);
if (0 == ret)
if (ret == 0)
{
ret = (int64_t)ftello(io->pFile);
}
@@ -1635,8 +1634,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
avContextTab[AVIdx]->interrupt_callback.opaque = context->playback;
}
#ifdef USE_CUSTOM_IO
if (0 == strstr(filename, "://") ||
0 == strncmp(filename, "file://", 7))
if (strstr(filename, "://") == 0 || strncmp(filename, "file://", 7) == 0)
{
AVIOContext *avio_ctx = NULL;
custom_io_tab[AVIdx] = malloc(sizeof(CustomIOCtx_t));
@@ -1672,7 +1670,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
eRTMPProtoImplType rtmpProtoImplType = RTMP_NONE;
uint8_t numOfRTMPImpl = 0;
if (0 == strncmp(filename, "ffrtmp", 6))
if (strncmp(filename, "ffrtmp", 6) == 0)
{
filename = filename + 2;
rtmpProtoImplType = RTMP_NATIVE;
@@ -1687,12 +1685,12 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
rtmpProtoImplType = RTMP_LIBRTMP;
}
if (0 == strncmp(filename, "rtmp://", 7) ||
0 == strncmp(filename, "rtmpe://", 8) ||
0 == strncmp(filename, "rtmps://", 8) ||
0 == strncmp(filename, "rtmpt://", 8) ||
0 == strncmp(filename, "rtmpte://", 9) ||
0 == strncmp(filename, "rtmpts://", 9))
if (strncmp(filename, "rtmp://", 7) == 0 ||
strncmp(filename, "rtmpe://", 8) == 0 ||
strncmp(filename, "rtmps://", 8) == 0 ||
strncmp(filename, "rtmpt://", 8) == 0 ||
strncmp(filename, "rtmpte://", 9) == 0 ||
strncmp(filename, "rtmpts://", 9) == 0)
{
/* At first we need to check which protocol
* implementations we have
@@ -1703,17 +1701,17 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
while ((protoName = avio_enum_protocols(&opaque, 1)))
{
if (0 == strcmp("rtmp", protoName))
if (strcmp("rtmp", protoName) == 0)
{
++numOfRTMPImpl;
}
else if (0 == strcmp("ffrtmp", protoName))
else if (strcmp("ffrtmp", protoName) == 0)
{
// ffmpeg has patch to have both native and librtmp implementations
++numOfRTMPImpl;
haveNativeProto = 2;
}
else if (0 == strncmp("rtmpts", protoName, 6))
else if (strncmp("rtmpts", protoName, 6) == 0)
{
// rtmpts is only available in native implementation
// rtmpts is listed after rtmp
@@ -1881,8 +1879,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
}
}
}
else if (0 == strncmp(filename, "http://", 7) ||
0 == strncmp(filename, "https://", 8))
else if (strncmp(filename, "http://", 7) == 0 || strncmp(filename, "https://", 8) == 0)
{
char num[16];
@@ -1954,7 +1951,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin
{
ffmpeg_real_read_org = avContextTab[AVIdx]->pb->read_packet;
if (0 == AVIdx && strstr(filename, "://") != 0 && strncmp(filename, "file://", 7) != 0)
if (AVIdx == 0 && strstr(filename, "://") != 0 && strncmp(filename, "file://", 7) != 0)
{
if (ffmpeg_buf_size > 0 && ffmpeg_buf_size > FILLBUFDIFF + FILLBUFPAKET)
{
@@ -2127,7 +2124,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
{
uint32_t n = 0;
ffmpeg_printf(1, "cAVIdx[%d]: stream with multi programs: num of programs %d\n", cAVIdx, avContext->nb_programs);
for (n = 0; n < avContext->nb_programs && (0 == nb_stream_indexes || stream_index == NULL); n++)
for (n = 0; n < avContext->nb_programs && (nb_stream_indexes == 0 || stream_index == NULL); n++)
{
AVProgram *p = avContext->programs[n];
if (p->nb_stream_indexes)
@@ -2251,7 +2248,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
case AVMEDIA_TYPE_VIDEO:
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", get_codecpar(stream)->codec_type);
// do not discard any stream from second context
stream->discard = 0 == cAVIdx ? AVDISCARD_ALL : AVDISCARD_DEFAULT; /* by default we discard all video streams */
stream->discard = cAVIdx == 0 ? AVDISCARD_ALL : AVDISCARD_DEFAULT; /* by default we discard all video streams */
if (encoding != NULL)
{
@@ -2270,7 +2267,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
track.aspect_ratio_num = stream->sample_aspect_ratio.num;
track.aspect_ratio_den = stream->sample_aspect_ratio.den;
if (0 == track.aspect_ratio_num || 0 == track.aspect_ratio_den)
if (track.aspect_ratio_num == 0 || track.aspect_ratio_den == 0)
{
track.aspect_ratio_num = get_codecpar(stream)->sample_aspect_ratio.num;
track.aspect_ratio_den = get_codecpar(stream)->sample_aspect_ratio.den;
@@ -2316,7 +2313,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
track.Id = ((AVStream *)(track.stream))->id;
track.duration = (int64_t)av_rescale(stream->duration, (int64_t)stream->time_base.num * 1000, stream->time_base.den);
if (stream->duration == AV_NOPTS_VALUE || 0 == strncmp(avContext->iformat->name, "dash", 4))
if (stream->duration == AV_NOPTS_VALUE || strncmp(avContext->iformat->name, "dash", 4) == 0)
{
ffmpeg_printf(10, "Stream has no duration so we take the duration from context\n");
track.duration = (int64_t) avContext->duration / 1000;
@@ -2354,7 +2351,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
case AVMEDIA_TYPE_AUDIO:
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type);
// do not discard any stream from second context
stream->discard = 0 == cAVIdx ? AVDISCARD_ALL : AVDISCARD_DEFAULT;
stream->discard = cAVIdx == 0 ? AVDISCARD_ALL : AVDISCARD_DEFAULT;
if (encoding != NULL)
{
@@ -2426,8 +2423,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
}
else if (get_codecpar(stream)->codec_id == AV_CODEC_ID_AAC)
{
if (0 == strncmp(avContext->iformat->name, "mpegts", 6) ||
0 == strncmp(avContext->iformat->name, "hls,", 4))
if (strncmp(avContext->iformat->name, "mpegts", 6) == 0 || strncmp(avContext->iformat->name, "hls,", 4) == 0)
{
const char marker[] = "ADTS";
track.aacbuflen = sizeof(marker) / sizeof(char);