@@ -153,6 +153,8 @@ struct MpegTSContext {
int resync_size;
int merge_pmt_versions;
+ /* Lorex LNC crf file */
+ int lorex_crf;
/******************************************/
/* private mpegts data */
@@ -860,6 +862,10 @@ static const StreamType METADATA_types[] = {
{ 0 },
};
+static const StreamType crf_types[] = {
+ { 0x06, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW },
+};
+
/* descriptor present */
static const StreamType DESC_types[] = {
{ 0x6a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 }, /* AC-3 descriptor */
@@ -947,6 +953,12 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
}
if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, pes->stream_type, MISC_types);
+ if (pes->ts->lorex_crf && st->codecpar->codec_id == AV_CODEC_ID_NONE)
+ mpegts_find_stream_type(st, pes->stream_type, crf_types);
+ if (st->codecpar->codec_id == AV_CODEC_ID_PCM_MULAW) {
+ st->codecpar->channels = 1;
+ st->codecpar->sample_rate = 8000;
+ }
if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {
st->codecpar->codec_id = old_codec_id;
st->codecpar->codec_type = old_codec_type;
@@ -3054,8 +3066,13 @@ static int mpegts_read_header(AVFormatContext *s)
s->internal->prefer_codec_framerate = 1;
- if (ffio_ensure_seekback(pb, probesize) < 0)
+ if (ffio_ensure_seekback(pb, probesize) < 0) {
av_log(s, AV_LOG_WARNING, "Failed to allocate buffers for seekback\n");
+ } else {
+ if ((avio_rb64(pb) & 0xFFFFFF00FFFFFFFF) == 0x474011000042b025)
+ ts->lorex_crf = 1;
+ avio_seek(pb, -8, SEEK_CUR);
+ }
pos = avio_tell(pb);
ts->raw_packet_size = get_packet_size(s);