mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-31 09:20:58 +02:00
Merge remote-tracking branch 'libstb-hal-max/master'
Origin commit data
------------------
Branch: master
Commit: d67295ea7e
Author: max_10 <max_10@gmx.de>
Date: 2018-03-18 (Sun, 18 Mar 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -39,6 +39,7 @@ typedef struct hw_caps
|
||||
int display_can_set_brightness;
|
||||
int display_can_deepstandby;
|
||||
int display_has_statusline;
|
||||
int has_button_timer;
|
||||
char boxvendor[64];
|
||||
char boxname[64];
|
||||
char boxarch[64];
|
||||
|
@@ -37,6 +37,7 @@ hw_caps_t *get_hwcaps(void)
|
||||
caps.display_can_deepstandby = 0;
|
||||
caps.display_can_set_brightness = 1;
|
||||
caps.display_has_statusline = 0;
|
||||
caps.has_button_timer = 1;
|
||||
caps.has_HDMI = 1;
|
||||
strcpy(caps.boxvendor, "AX-Technologies");
|
||||
strcpy(caps.boxname, "HD51");
|
||||
|
@@ -361,7 +361,7 @@ void cVideo::closeDevice(void)
|
||||
int cVideo::setAspectRatio(int aspect, int mode)
|
||||
{
|
||||
static const char *a[] = { "n/a", "4:3", "14:9", "16:9" };
|
||||
static const char *m[] = { "panscan", "bestfit", "letterbox", "nonlinear", "(unset)" };
|
||||
static const char *m[] = { "panscan", "letterbox", "bestfit", "nonlinear", "(unset)" };
|
||||
int n;
|
||||
lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mode < 0||mode > 3) ? 4 : mode]);
|
||||
|
||||
|
@@ -136,6 +136,8 @@ static int64_t prev_seek_time_sec = -1;
|
||||
|
||||
static int32_t seek_target_flag = 0;
|
||||
|
||||
static int32_t mutexInitialized = 0;
|
||||
|
||||
/* ***************************** */
|
||||
/* Prototypes */
|
||||
/* ***************************** */
|
||||
@@ -155,6 +157,43 @@ void progressive_playback_set(int32_t val)
|
||||
progressive_playback = val;
|
||||
}
|
||||
|
||||
static void initMutex(void)
|
||||
{
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
mutexInitialized = 1;
|
||||
}
|
||||
|
||||
static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line __attribute__((unused)))
|
||||
{
|
||||
ffmpeg_printf(100, "::%d requesting mutex\n", line);
|
||||
if (!mutexInitialized)
|
||||
{
|
||||
initMutex();
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
ffmpeg_printf(100, "::%d received mutex\n", line);
|
||||
}
|
||||
|
||||
static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line __attribute__((unused)))
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
ffmpeg_printf(100, "::%d released mutex\n", line);
|
||||
}
|
||||
|
||||
typedef int32_t (* Write_FN)(Context_t *context, void *);
|
||||
|
||||
static int32_t Write(Write_FN WriteFun, Context_t *context, void *privateData)
|
||||
{
|
||||
/* Because Write is blocking we will release mutex which protect
|
||||
* avformat structures, during write time
|
||||
*/
|
||||
int32_t ret = 0;
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
ret = WriteFun(context, privateData);
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "buff_ffmpeg.c"
|
||||
#include "wrapped_ffmpeg.c"
|
||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56, 34, 100)
|
||||
@@ -203,8 +242,6 @@ static void ffmpeg_silen_callback(void *avcl __attribute__((unused)), int level
|
||||
return;
|
||||
}
|
||||
|
||||
static int32_t mutexInitialized = 0;
|
||||
|
||||
void sel_program_id_set(const int32_t val)
|
||||
{
|
||||
g_sel_program_id = val;
|
||||
@@ -275,29 +312,6 @@ int32_t ffmpeg_av_dict_set(const char *key, const char *value, int32_t flags)
|
||||
return av_dict_set(&avio_opts, key, value, flags);
|
||||
}
|
||||
|
||||
static void initMutex(void)
|
||||
{
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
mutexInitialized = 1;
|
||||
}
|
||||
|
||||
static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line __attribute__((unused)))
|
||||
{
|
||||
ffmpeg_printf(100, "::%d requesting mutex\n", line);
|
||||
if (!mutexInitialized)
|
||||
{
|
||||
initMutex();
|
||||
}
|
||||
pthread_mutex_lock(&mutex);
|
||||
ffmpeg_printf(100, "::%d received mutex\n", line);
|
||||
}
|
||||
|
||||
static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line __attribute__((unused)))
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
ffmpeg_printf(100, "::%d released mutex\n", line);
|
||||
}
|
||||
|
||||
static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extradata, int extradata_size, int profile __attribute__((unused)), int32_t *version)
|
||||
{
|
||||
ffmpeg_printf(10, "Codec ID: %d (%.8lx)\n", codec_id, codec_id);
|
||||
@@ -718,6 +732,8 @@ static void FFMPEGThread(Context_t *context)
|
||||
Track_t *subtitleTrack = NULL;
|
||||
int32_t pid = avContextTab[cAVIdx]->streams[packet.stream_index]->id;
|
||||
reset_finish_timeout();
|
||||
if (avContextTab[cAVIdx]->streams[packet.stream_index]->discard != AVDISCARD_ALL)
|
||||
{
|
||||
if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0)
|
||||
{
|
||||
ffmpeg_err("error getting video track\n");
|
||||
@@ -730,6 +746,11 @@ static void FFMPEGThread(Context_t *context)
|
||||
{
|
||||
ffmpeg_err("error getting subtitle track\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ffmpeg_printf(1, "SKIP DISCARDED PACKET stream_index[%d] pid[%d]\n", packet.size, (int)packet.stream_index, pid);
|
||||
}
|
||||
ffmpeg_printf(200, "packet.size %d - index %d\n", packet.size, pid);
|
||||
if (videoTrack && (videoTrack->AVIdx == (int)cAVIdx) && (videoTrack->Id == pid))
|
||||
{
|
||||
@@ -814,7 +835,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
{
|
||||
avOut.infoFlags = 1; // TS container
|
||||
}
|
||||
if (context->output->video->Write(context, &avOut) < 0)
|
||||
if (Write(context->output->video->Write, context, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to video device failed\n");
|
||||
}
|
||||
@@ -882,7 +903,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
if (context->output->audio->Write(context, &avOut) < 0)
|
||||
if (Write(context->output->audio->Write, context, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("(raw pcm) writing data to audio device failed\n");
|
||||
}
|
||||
@@ -1058,7 +1079,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0)
|
||||
if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to audio device failed\n");
|
||||
}
|
||||
@@ -1079,7 +1100,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0)
|
||||
if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("(aac) writing data to audio device failed\n");
|
||||
}
|
||||
@@ -1096,7 +1117,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
avOut.width = 0;
|
||||
avOut.height = 0;
|
||||
avOut.type = "audio";
|
||||
if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0)
|
||||
if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to audio device failed\n");
|
||||
}
|
||||
@@ -1125,7 +1146,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
subOut.data = (uint8_t *)packet.data;
|
||||
subOut.pts = pts;
|
||||
subOut.durationMS = duration;
|
||||
if (context->output->subtitle->Write(context, &subOut) < 0)
|
||||
if (Write(context->output->subtitle->Write, context, &subOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to teletext fifo failed\n");
|
||||
}
|
||||
@@ -1650,19 +1671,21 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames)
|
||||
|
||||
int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32_t initial)
|
||||
{
|
||||
Track_t *audioTrack = NULL;
|
||||
Track_t *subtitleTrack = NULL;
|
||||
Track_t *currAudioTrack = NULL;
|
||||
Track_t *currSubtitleTrack = NULL;
|
||||
uint32_t addedVideoTracksCount = 0;
|
||||
if (terminating)
|
||||
{
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
if (initial && context->manager->subtitle)
|
||||
{
|
||||
context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack);
|
||||
context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &currSubtitleTrack);
|
||||
}
|
||||
if (context->manager->audio)
|
||||
{
|
||||
context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
|
||||
context->manager->audio->Command(context, MANAGER_GET_TRACK, &currAudioTrack);
|
||||
}
|
||||
if (context->manager->video)
|
||||
{
|
||||
@@ -1748,8 +1771,12 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
}
|
||||
}
|
||||
if (!isStreamFromSelProg)
|
||||
{
|
||||
stream->discard = AVDISCARD_ALL;
|
||||
ffmpeg_printf(1, "cAVIdx[%d]: add DISCARD flag to stream index[%d]\n", cAVIdx, stream->index);
|
||||
continue; // skip this stream
|
||||
}
|
||||
}
|
||||
encoding = Codec2Encoding((int32_t)get_codecpar(stream)->codec_id, (int32_t)get_codecpar(stream)->codec_type, \
|
||||
(uint8_t *)get_codecpar(stream)->extradata, \
|
||||
(int)get_codecpar(stream)->extradata_size, \
|
||||
@@ -1775,6 +1802,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);
|
||||
stream->discard = AVDISCARD_ALL; /* by default we discard all video streams */
|
||||
if (encoding != NULL)
|
||||
{
|
||||
track.type = eTypeES;
|
||||
@@ -1844,6 +1872,14 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
/* konfetti: fixme: is this a reason to return with error? */
|
||||
ffmpeg_err("failed to add track %d\n", n);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addedVideoTracksCount == 0) /* at now we can handle only first video track */
|
||||
{
|
||||
stream->discard = AVDISCARD_DEFAULT;
|
||||
}
|
||||
addedVideoTracksCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1853,6 +1889,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type);
|
||||
stream->discard = AVDISCARD_ALL;
|
||||
if (encoding != NULL)
|
||||
{
|
||||
AVDictionaryEntry *lang;
|
||||
@@ -2172,11 +2209,45 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
case AVMEDIA_TYPE_ATTACHMENT:
|
||||
case AVMEDIA_TYPE_NB:
|
||||
default:
|
||||
stream->discard = AVDISCARD_ALL;
|
||||
ffmpeg_err("not handled or unknown codec_type %d\n", get_codecpar(stream)->codec_type);
|
||||
break;
|
||||
}
|
||||
} /* for */
|
||||
}
|
||||
if (context->manager->audio)
|
||||
{
|
||||
Track_t *Tracks = NULL;
|
||||
int32_t TrackCount = 0;
|
||||
int32_t selTrackIdx = -1;
|
||||
context->manager->audio->Command(context, MANAGER_REF_LIST, &Tracks);
|
||||
context->manager->audio->Command(context, MANAGER_REF_LIST_SIZE, &TrackCount);
|
||||
if (Tracks && TrackCount)
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < TrackCount; ++i)
|
||||
{
|
||||
if (Tracks[i].pending || Tracks[i].Id < 0)
|
||||
continue;
|
||||
if (selTrackIdx == -1)
|
||||
selTrackIdx = i;
|
||||
if (currAudioTrack && currAudioTrack->Id == Tracks[i].Id)
|
||||
{
|
||||
selTrackIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selTrackIdx > -1)
|
||||
{
|
||||
((AVStream *)Tracks[selTrackIdx].stream)->discard = AVDISCARD_DEFAULT;
|
||||
if (!currAudioTrack || currAudioTrack->Id != Tracks[selTrackIdx].Id)
|
||||
{
|
||||
context->manager->audio->Command(context, MANAGER_SET, &Tracks[selTrackIdx].Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -2442,7 +2513,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab
|
||||
{
|
||||
seek_target_flag |= AVSEEK_FLAG_BACKWARD;
|
||||
}
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
if (!context->playback || !context->playback->isPlaying)
|
||||
{
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
@@ -2458,7 +2528,9 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab
|
||||
* seeking per HTTP does still not work very good. forward seeks everytime
|
||||
* about 10 seconds, backward does not work.
|
||||
*/
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
off_t pos = avio_tell(avContextTab[0]->pb);
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
ffmpeg_printf(10, "pos %lld %lld\n", pos, avContextTab[0]->bit_rate);
|
||||
if (avContextTab[0]->bit_rate)
|
||||
{
|
||||
@@ -2484,7 +2556,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab
|
||||
seek_target_seconds = sec;
|
||||
do_seek_target_seconds = 1;
|
||||
}
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -2539,8 +2610,25 @@ 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 __attribute__((unused)))
|
||||
{
|
||||
ffmpeg_printf(10, "track %d\n", *arg);
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
if (context->manager->audio)
|
||||
{
|
||||
Track_t *Tracks = NULL;
|
||||
int32_t TrackCount = 0;
|
||||
context->manager->audio->Command(context, MANAGER_REF_LIST, &Tracks);
|
||||
context->manager->audio->Command(context, MANAGER_REF_LIST_SIZE, &TrackCount);
|
||||
if (Tracks && TrackCount)
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < TrackCount; ++i)
|
||||
{
|
||||
((AVStream *)Tracks[i].stream)->discard = Tracks[i].Id == *arg ? AVDISCARD_DEFAULT : AVDISCARD_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
/* Hellmaster1024: nothing to do here! */
|
||||
int64_t sec = -5;
|
||||
int64_t sec = -1;
|
||||
context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec);
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
@@ -2553,7 +2641,7 @@ static int32_t container_ffmpeg_switch_subtitle(Context_t *context, int32_t *arg
|
||||
* we seek to force ffmpeg to read once again the same data
|
||||
* but now we will not ignore subtitle frame
|
||||
*/
|
||||
int64_t sec = -5;
|
||||
int64_t sec = -1;
|
||||
context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec);
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ static int flv2mpeg4_context_write_packet_cb(void *usr_data, int keyframe, int p
|
||||
avOut.width = ctx->track->width;
|
||||
avOut.height = ctx->track->height;
|
||||
avOut.type = "video";
|
||||
if (ctx->out_ctx->output->video->Write(ctx->out_ctx, &avOut) < 0)
|
||||
if (Write(ctx->out_ctx->output->video->Write, ctx->out_ctx, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to video device failed\n");
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ static void mpeg4p2_write(Context_t *ctx, Track_t *track, int avContextIdx, int6
|
||||
avOut.width = track->width;
|
||||
avOut.height = track->height;
|
||||
avOut.type = "video";
|
||||
if (ctx->output->video->Write(ctx, &avOut) < 0)
|
||||
if (Write(ctx->output->video->Write, ctx, &avOut) < 0)
|
||||
{
|
||||
ffmpeg_err("writing data to video device failed\n");
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@ typedef enum
|
||||
MANAGER_INIT_UPDATE,
|
||||
MANAGER_UPDATED_TRACK_INFO,
|
||||
MANAGER_REGISTER_UPDATED_TRACK_INFO,
|
||||
MANAGER_REF_LIST,
|
||||
MANAGER_REF_LIST_SIZE,
|
||||
} ManagerCmd_t;
|
||||
|
||||
typedef enum
|
||||
|
@@ -71,7 +71,7 @@ typedef struct Output_s
|
||||
{
|
||||
char *Name;
|
||||
int32_t (* Command)(Context_t *, OutputCmd_t, void *);
|
||||
int32_t (* Write)(Context_t *, void *privateData);
|
||||
int32_t (* Write)(Context_t *, void *);
|
||||
char **Capabilities;
|
||||
} Output_t;
|
||||
|
||||
|
@@ -635,7 +635,7 @@ int main(int argc, char *argv[])
|
||||
memset(argvBuff, '\0', sizeof(argvBuff));
|
||||
int commandRetVal = -1;
|
||||
/* inform client that we can handle additional commands */
|
||||
fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 36);
|
||||
fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 39);
|
||||
if (0 != ParseParams(argc, argv, file, audioFile, &audioTrackIdx, &subtitleTrackIdx))
|
||||
{
|
||||
printf("Usage: exteplayer3 filePath [-u user-agent] [-c cookies] [-h headers] [-p prio] [-a] [-d] [-w] [-l] [-s] [-i] [-t audioTrackId] [-9 subtitleTrackId] [-x separateAudioUri] plabackUri\n");
|
||||
|
@@ -231,6 +231,16 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
*((char ** *) argument) = (char **) ManagerList(context);
|
||||
break;
|
||||
}
|
||||
case MANAGER_REF_LIST:
|
||||
{
|
||||
*((Track_t **)argument) = Tracks;
|
||||
break;
|
||||
}
|
||||
case MANAGER_REF_LIST_SIZE:
|
||||
{
|
||||
*((int *)argument) = TrackCount;
|
||||
break;
|
||||
}
|
||||
case MANAGER_GET:
|
||||
{
|
||||
audio_mgr_printf(20, "%s::%s MANAGER_GET\n", __FILE__, __FUNCTION__);
|
||||
|
@@ -88,6 +88,7 @@ static unsigned int NalLengthBytes = 1;
|
||||
static unsigned char *CodecData = NULL;
|
||||
static unsigned int CodecDataLen = 0;
|
||||
static int avc3 = 0;
|
||||
static int sps_pps_in_stream = 0;
|
||||
|
||||
/* ***************************** */
|
||||
/* Prototypes */
|
||||
@@ -281,6 +282,7 @@ static int reset()
|
||||
{
|
||||
initialHeader = 1;
|
||||
avc3 = 0;
|
||||
sps_pps_in_stream = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -321,19 +323,27 @@ static int writeData(WriterAVCallData_t *call)
|
||||
((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) ||
|
||||
(call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))))
|
||||
{
|
||||
uint32_t i = 0;
|
||||
uint8_t InsertPrivData = !sps_pps_in_stream;
|
||||
uint32_t PacketLength = 0;
|
||||
uint32_t FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE;
|
||||
iov[ic++].iov_base = PesHeader;
|
||||
initialHeader = 0;
|
||||
//if (initialHeader) // some rtsp streams can update codec data at runtime
|
||||
while (InsertPrivData && i < 36 && (call->len - i) > 5)
|
||||
{
|
||||
if ((call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && call->data[i + 3] == 0x01 && (call->data[i + 4] == 0x67 || call->data[i + 4] == 0x68)))
|
||||
{
|
||||
InsertPrivData = 0;
|
||||
sps_pps_in_stream = 1;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
if (InsertPrivData && call->private_size > 0 /*&& initialHeader*/) // some rtsp streams can update codec data at runtime
|
||||
{
|
||||
initialHeader = 0;
|
||||
iov[ic].iov_base = call->private_data;
|
||||
iov[ic++].iov_len = call->private_size;
|
||||
PacketLength += call->private_size;
|
||||
}
|
||||
iov[ic].iov_base = "";
|
||||
iov[ic++].iov_len = 1;
|
||||
iov[ic].iov_base = call->data;
|
||||
iov[ic++].iov_len = call->len;
|
||||
PacketLength += call->len;
|
||||
@@ -348,7 +358,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
uint32_t PacketLength = 0;
|
||||
ic = 0;
|
||||
iov[ic++].iov_base = PesHeader;
|
||||
if (initialHeader)
|
||||
//if (initialHeader)
|
||||
{
|
||||
if (CodecData)
|
||||
{
|
||||
|
Reference in New Issue
Block a user