Skip to content

Commit 50b51e4

Browse files
cfsmp3claude
andcommitted
fix(xds): Don't output empty XDS content entries
When outputting US TV Parental Guidelines ContentAdvisory XDS data, the code was always calling xdsprint() for both the age rating and the content flags (violence, language, etc). However, if there are no content flags (e.g., for TV-G which has no additional advisories), the content string is empty. This caused duplicate XDS entries in the output - one with the age rating and one with an empty string. The fix only outputs the content string if it is not empty. Fixes regression test 113 output mismatch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2f0770d commit 50b51e4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib_ccx/ccx_decoders_xds.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,17 @@ void xds_do_content_advisory(struct cc_subtitle *sub, struct ccx_decoders_xds_co
472472
if (!a1 && a0) // US TV parental guidelines
473473
{
474474
xdsprint(sub, ctx, age);
475-
xdsprint(sub, ctx, content);
475+
if (content[0]) // Only output content if not empty
476+
xdsprint(sub, ctx, content);
476477
if (changed)
477478
{
478479
ccx_common_logging.log_ftn("\rXDS: %s\n ", age);
479-
ccx_common_logging.log_ftn("\rXDS: %s\n ", content);
480+
if (content[0])
481+
ccx_common_logging.log_ftn("\rXDS: %s\n ", content);
480482
}
481483
ccx_common_logging.debug_ftn(CCX_DMT_DECODER_XDS, "\rXDS: %s\n", age);
482-
ccx_common_logging.debug_ftn(CCX_DMT_DECODER_XDS, "\rXDS: %s\n", content);
484+
if (content[0])
485+
ccx_common_logging.debug_ftn(CCX_DMT_DECODER_XDS, "\rXDS: %s\n", content);
483486
}
484487
if (!a0 || // MPA
485488
(a0 && a1 && !Da2 && !La3) || // Canadian English Language Rating

0 commit comments

Comments
 (0)