diff --git a/src/lib_ccx/ccx_common_constants.h b/src/lib_ccx/ccx_common_constants.h index 6224ff0ba..fe7ca15a4 100644 --- a/src/lib_ccx/ccx_common_constants.h +++ b/src/lib_ccx/ccx_common_constants.h @@ -122,6 +122,7 @@ enum ccx_stream_type CCX_STREAM_TYPE_AUDIO_AAC = 0x0f, CCX_STREAM_TYPE_VIDEO_MPEG4 = 0x10, CCX_STREAM_TYPE_VIDEO_H264 = 0x1b, + CCX_STREAM_TYPE_VIDEO_HEVC = 0x24, CCX_STREAM_TYPE_PRIVATE_USER_MPEG2 = 0x80, CCX_STREAM_TYPE_AUDIO_AC3 = 0x81, CCX_STREAM_TYPE_AUDIO_HDMV_DTS = 0x82, @@ -230,14 +231,15 @@ enum ccx_bufferdata_type CCX_PES = 1, CCX_RAW = 2, CCX_H264 = 3, - CCX_HAUPPAGE = 4, - CCX_TELETEXT = 5, - CCX_PRIVATE_MPEG2_CC = 6, - CCX_DVB_SUBTITLE = 7, - CCX_ISDB_SUBTITLE = 8, + CCX_HAUPPAGE = 4, // Restored to original value + CCX_TELETEXT = 5, // Restored to original value + CCX_PRIVATE_MPEG2_CC = 6, // Restored to original value + CCX_DVB_SUBTITLE = 7, // Restored to original value + CCX_ISDB_SUBTITLE = 8, // Restored to original value /* BUffer where cc data contain 3 byte cc_valid ccdata 1 ccdata 2 */ - CCX_RAW_TYPE = 9, - CCX_DVD_SUBTITLE = 10 + CCX_RAW_TYPE = 9, // Restored to original value + CCX_DVD_SUBTITLE = 10, // Restored to original value + CCX_HEVC = 11 // Moved to end to avoid breaking existing code }; enum ccx_frame_type diff --git a/src/lib_ccx/general_loop.c b/src/lib_ccx/general_loop.c index 109bae775..d4f778641 100644 --- a/src/lib_ccx/general_loop.c +++ b/src/lib_ccx/general_loop.c @@ -720,6 +720,11 @@ int process_data(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, str dec_ctx->in_bufferdatatype = CCX_H264; got = process_avc(enc_ctx, dec_ctx, data_node->buffer, data_node->len, dec_sub); } + else if (data_node->bufferdatatype == CCX_HEVC) // HEVC data from TS file + { + dec_ctx->in_bufferdatatype = CCX_HEVC; + got = process_avc(enc_ctx, dec_ctx, data_node->buffer, data_node->len, dec_sub); + } else if (data_node->bufferdatatype == CCX_RAW_TYPE) { got = process_raw_with_field(dec_ctx, dec_sub, data_node->buffer, data_node->len); diff --git a/src/lib_ccx/sequencing.c b/src/lib_ccx/sequencing.c index 5ece1f900..9a105395e 100644 --- a/src/lib_ccx/sequencing.c +++ b/src/lib_ccx/sequencing.c @@ -102,7 +102,7 @@ void process_hdcc(struct encoder_ctx *enc_ctx, struct lib_cc_decode *dec_ctx, st { // We rely on this. - if (dec_ctx->in_bufferdatatype == CCX_H264) + if (dec_ctx->in_bufferdatatype == CCX_H264 || dec_ctx->in_bufferdatatype == CCX_HEVC) reset_cb = 1; // If fts_now is unchanged we rely on cc block counting, diff --git a/src/lib_ccx/ts_functions.c b/src/lib_ccx/ts_functions.c index 624093f48..b061f9df9 100644 --- a/src/lib_ccx/ts_functions.c +++ b/src/lib_ccx/ts_functions.c @@ -36,6 +36,10 @@ char *get_buffer_type_str(struct cap_info *cinfo) { return strdup("H.264"); } + else if (cinfo->stream == CCX_STREAM_TYPE_VIDEO_HEVC) + { + return strdup("HEVC"); + } else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_ISDB_CC) { return strdup("ISDB CC subtitle"); @@ -129,6 +133,10 @@ enum ccx_bufferdata_type get_buffer_type(struct cap_info *cinfo) { return CCX_H264; } + else if (cinfo->stream == CCX_STREAM_TYPE_VIDEO_HEVC) + { + return CCX_HEVC; + } else if (cinfo->stream == CCX_STREAM_TYPE_PRIVATE_MPEG2 && cinfo->codec == CCX_CODEC_DVB) { return CCX_DVB_SUBTITLE; @@ -174,6 +182,7 @@ void init_ts(struct ccx_demuxer *ctx) desc[CCX_STREAM_TYPE_AUDIO_AAC] = "AAC audio"; desc[CCX_STREAM_TYPE_VIDEO_MPEG4] = "MPEG-4 video"; desc[CCX_STREAM_TYPE_VIDEO_H264] = "H.264 video"; + desc[CCX_STREAM_TYPE_VIDEO_HEVC] = "HEVC video"; desc[CCX_STREAM_TYPE_PRIVATE_USER_MPEG2] = "MPEG-2 User Private"; desc[CCX_STREAM_TYPE_AUDIO_AC3] = "AC3 audio"; desc[CCX_STREAM_TYPE_AUDIO_DTS] = "DTS audio"; @@ -593,7 +602,9 @@ int copy_payload_to_capbuf(struct cap_info *cinfo, struct ts_payload *payload) int newcapbuflen; if (cinfo->ignore == CCX_TRUE && - (cinfo->stream != CCX_STREAM_TYPE_VIDEO_MPEG2 || !ccx_options.analyze_video_stream)) + ((cinfo->stream != CCX_STREAM_TYPE_VIDEO_MPEG2 && + cinfo->stream != CCX_STREAM_TYPE_VIDEO_H264 && + cinfo->stream != CCX_STREAM_TYPE_VIDEO_HEVC) || !ccx_options.analyze_video_stream)) { return CCX_OK; } @@ -858,7 +869,9 @@ long ts_readstream(struct ccx_demuxer *ctx, struct demuxer_data **data) continue; } else if (cinfo->ignore == CCX_TRUE && - (cinfo->stream != CCX_STREAM_TYPE_VIDEO_MPEG2 || !ccx_options.analyze_video_stream)) + ((cinfo->stream != CCX_STREAM_TYPE_VIDEO_MPEG2 && + cinfo->stream != CCX_STREAM_TYPE_VIDEO_H264 && + cinfo->stream != CCX_STREAM_TYPE_VIDEO_HEVC) || !ccx_options.analyze_video_stream)) { if (cinfo->codec_private_data) { diff --git a/src/lib_ccx/ts_info.c b/src/lib_ccx/ts_info.c index a4ec32cec..f291c4c07 100644 --- a/src/lib_ccx/ts_info.c +++ b/src/lib_ccx/ts_info.c @@ -102,7 +102,9 @@ int get_video_stream(struct ccx_demuxer *ctx) struct cap_info *iter; list_for_each_entry(iter, &ctx->cinfo_tree.all_stream, all_stream, struct cap_info) { - if (iter->stream == CCX_STREAM_TYPE_VIDEO_MPEG2) + if (iter->stream == CCX_STREAM_TYPE_VIDEO_MPEG2 || + iter->stream == CCX_STREAM_TYPE_VIDEO_H264 || + iter->stream == CCX_STREAM_TYPE_VIDEO_HEVC) return iter->pid; } return -1; diff --git a/src/lib_ccx/ts_tables.c b/src/lib_ccx/ts_tables.c index ceb99a383..ccb21eb1e 100644 --- a/src/lib_ccx/ts_tables.c +++ b/src/lib_ccx/ts_tables.c @@ -15,6 +15,7 @@ unsigned get_printable_stream_type(enum ccx_stream_type stream_type) { case CCX_STREAM_TYPE_VIDEO_MPEG2: case CCX_STREAM_TYPE_VIDEO_H264: + case CCX_STREAM_TYPE_VIDEO_HEVC: case CCX_STREAM_TYPE_PRIVATE_MPEG2: case CCX_STREAM_TYPE_PRIVATE_TABLE_MPEG2: case CCX_STREAM_TYPE_MHEG_PACKETS: @@ -408,7 +409,7 @@ int parse_PMT(struct ccx_demuxer *ctx, unsigned char *buf, int len, struct progr } } - if (stream_type == CCX_STREAM_TYPE_VIDEO_H264 || stream_type == CCX_STREAM_TYPE_VIDEO_MPEG2) + if (stream_type == CCX_STREAM_TYPE_VIDEO_H264 || stream_type == CCX_STREAM_TYPE_VIDEO_MPEG2 || stream_type == CCX_STREAM_TYPE_VIDEO_HEVC) { update_capinfo(ctx, elementary_PID, stream_type, CCX_CODEC_ATSC_CC, program_number, NULL); // mprint ("Decode captions from program %d - %s stream [0x%02x] - PID: %u\n", diff --git a/src/rust/lib_ccxr/src/common/constants.rs b/src/rust/lib_ccxr/src/common/constants.rs index f6d865cbe..5a2f3807c 100644 --- a/src/rust/lib_ccxr/src/common/constants.rs +++ b/src/rust/lib_ccxr/src/common/constants.rs @@ -215,6 +215,7 @@ pub enum StreamType { AudioAac = 0x0f, VideoMpeg4 = 0x10, VideoH264 = 0x1b, + VideoHevc = 0x24, PrivateUserMpeg2 = 0x80, AudioAc3 = 0x81, AudioHdmvDts = 0x82,