PR #22653 opened by Jun Zhao (mypopydev)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22653
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22653.patch

1. lavf/mpegtsenc: Add parentheses to clarify operator precedence in CC update 
— Add explicit parentheses to (cc + 1) & 0xf for readability, even though the 
original expression was technically correct due to C operator precedence.

2. doc/muxers: fix mpegts muxer documentation — Fix the incorrect default value 
of mpegts_original_network_id (0x0001 → 0xff01) and add the missing 
hevc_digital_hdtv service type.


From c784e2e2c50fe1ad8f1d21a24c921a455978c0b7 Mon Sep 17 00:00:00 2001
From: Jun Zhao <[email protected]>
Date: Sun, 29 Mar 2026 16:19:12 +0800
Subject: [PATCH 1/2] lavf/mpegtsenc: Add parentheses to clarify operator
 precedence in CC update

While "cc + 1 & 0xf" is technically correct because addition has
higher precedence than bitwise AND in C, the intent of "(cc + 1) & 0xf"
is not immediately obvious without recalling the precedence table.

Add explicit parentheses to make the intended evaluation order clear
and improve readability.

Signed-off-by: Jun Zhao <[email protected]>
---
 libavformat/mpegtsenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 3578c3fd46..7f76883531 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -170,7 +170,7 @@ static void mpegts_write_section(MpegTSSection *s, uint8_t 
*buf, int len)
             b |= 0x40;
         *q++  = b;
         *q++  = s->pid;
-        s->cc = s->cc + 1 & 0xf;
+        s->cc = (s->cc + 1) & 0xf;
         *q++  = 0x10 | s->cc;
         if (s->discontinuity) {
             q[-1] |= 0x20;
@@ -1583,7 +1583,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream 
*st,
             val |= 0x40;
         *q++      = val;
         *q++      = ts_st->pid;
-        ts_st->cc = ts_st->cc + 1 & 0xf;
+        ts_st->cc = (ts_st->cc + 1) & 0xf;
         *q++      = 0x10 | ts_st->cc; // payload indicator + CC
         if (ts_st->discontinuity) {
             set_af_flag(buf, 0x80);
-- 
2.52.0


From 1947a90ce602902997ec8f937c85baf55d5c8267 Mon Sep 17 00:00:00 2001
From: Jun Zhao <[email protected]>
Date: Sun, 29 Mar 2026 16:28:48 +0800
Subject: [PATCH 2/2] doc/muxers: fix mpegts muxer documentation

Fix the default value of mpegts_original_network_id from 0x0001 to
0xff01 to match the actual code (DVB_PRIVATE_NETWORK_START).

Add the missing hevc_digital_hdtv service type to the
mpegts_service_type option list.

Signed-off-by: Jun Zhao <[email protected]>
---
 doc/muxers.texi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d27523e199..d8b3ca4a8c 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -3069,7 +3069,7 @@ Default is @code{0x0001}.
 Set the @samp{original_network_id}. This is unique identifier of a
 network in DVB. Its main use is in the unique identification of a service
 through the path @samp{Original_Network_ID, Transport_Stream_ID}. Default
-is @code{0x0001}.
+is @code{0xff01}.
 
 @item mpegts_service_id @var{integer}
 Set the @samp{service_id}, also known as program in DVB. Default is
@@ -3096,6 +3096,8 @@ MPEG2 Digital HDTV service.
 Advanced Codec Digital SDTV service.
 @item advanced_codec_digital_hdtv
 Advanced Codec Digital HDTV service.
+@item hevc_digital_hdtv
+HEVC Digital Television service.
 @end table
 
 @item mpegts_pmt_start_pid @var{integer}
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to