shaka-packager icon indicating copy to clipboard operation
shaka-packager copied to clipboard

Symbol & in EBU teletext incorrectly urlencoded two times

Open acris5 opened this issue 5 months ago • 0 comments

System info

Operating System: docker Shaka Packager Version: 9cb00e91ab0d081b1f2132abaad7c23ef15047b7

Issue and steps to reproduce the problem

When teletext includes & symbol we have & in the output ttml+mp4 files Packager Command:

packager  \
'in=/shaka-packager/pipes/pipe1,stream=video,init_segment=/shaka-results/bitrate_1/video_init.mp4,segment_template=/shaka-results/bitrate_1/video_$Number$.m4s,playlist_name=/shaka-results/bitrate_1/video.m3u8' \
'in=/shaka-packager/pipes/pipe1,stream=audio,lang=ru,init_segment=/shaka-results/bitrate_1/audio_init.mp4,segment_template=/shaka-results/bitrate_1/audio_$Number$.m4s,playlist_name=/shaka-results/bitrate_1/audio.m3u8' \
'in=/shaka-packager/pipes/pipe1,stream=text,format=ttml+mp4,init_segment=/shaka-results/bitrate_1/text_init.mp4,segment_template=/shaka-results/bitrate_1/text_$Number$.m4s,lang=ru,playlist_name=/shaka-results/bitrate_1/text.m3u8' \
 --max_hd_pixels 8294400 --hls_master_playlist_output /shaka-results/demo_master.m3u8 --mpd_output /shaka-results/manifest.mpd --hls_playlist_type LIVE \
 --segment_duration 2 --min_buffer_time 4 --suggested_presentation_delay 10 --time_shift_buffer_depth 12 --allow_approximate_segment_timeline --preserved_segments_outside_live_window 20 --default_text_zero_bias_ms 600000

What is the expected result? Symbol & should be urlencoded once to the output

What happens instead? I found following code in es_parser_teletext.cc but it works incorrectly because "& amp;" then goes to Urlencode function again and we have & amp;amp; in result files.

switch (next_char) {
      case '&':
        next_string.append("&");
        break;
      case '<':
        next_string.append("&lt;");
        break;
      default: {
        const std::string replacement(current_charset_[next_char - 0x20]);
        next_string.append(replacement);
      } break;
    }

acris5 avatar Sep 05 '24 17:09 acris5