History

lavf/mpegts: Convert service_name and service_provider to utf-8.

Fixes ticket #6320.

Carl Eugen Hoyos committed 7 years ago

Commit 5c515b51 parent 5b32f942 files · +45 −1Browse files

Unified · Split

2 files
  1. libavformat/mpegts.c +44 −0
  2. libavformat/version.h +1 −1
libavformat/mpegts.c+44−0
@@ -37,6 +37,9 @@ · 36 unmodified lines
37#include "avio_internal.h"37#include "avio_internal.h"
38#include "mpeg.h"38#include "mpeg.h"
39#include "isom.h"39#include "isom.h"
40#if CONFIG_ICONV
41#include <iconv.h>
42#endif
40 43
41/* maximum size in which we look for synchronization if44/* maximum size in which we look for synchronization if
42 * synchronization is lost */45 * synchronization is lost */
@@ -674,6 +677,47 @@ static char *getstr8(const uint8_t **pp, const uint8_t *p_end) · 631 unmodified lines
674 return NULL;677 return NULL;
675 if (len > p_end - p)678 if (len > p_end - p)
676 return NULL;679 return NULL;
680#if CONFIG_ICONV
681 if (len && *p < 0x20) {
682 const char *encodings[] = {
683 "ISO6937", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7",
684 "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-11",
685 "", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "", "", "", "",
686 "", "ISO-10646", "KSC_5601", "GB2312", "UCS-2BE", "UTF-8", "", "",
687 "", "", "", "", "", "", "", ""
688 };
689 iconv_t cd;
690 char *in, *out;
691 size_t inlen = len - 1, outlen = inlen * 6 + 1;
692 if (len >= 3 && p[0] == 0x10 && !p[1] && p[2] && p[2] <= 0xf && p[2] != 0xc) {
693 char iso8859[12];
694 snprintf(iso8859, sizeof(iso8859), "ISO-8859-%d", p[2]);
695 inlen -= 2;
696 in = (char *)p + 3;
697 cd = iconv_open("UTF-8", iso8859);
698 } else {
699 in = (char *)p + 1;
700 cd = iconv_open("UTF-8", encodings[*p]);
701 }
702 if (cd == (iconv_t)-1)
703 goto no_iconv;
704 str = out = av_malloc(outlen);
705 if (!str) {
706 iconv_close(cd);
707 return NULL;
708 }
709 if (iconv(cd, &in, &inlen, &out, &outlen) == -1) {
710 iconv_close(cd);
711 av_freep(&str);
712 goto no_iconv;
713 }
714 iconv_close(cd);
715 *out = 0;
716 *pp = p + len;
717 return str;
718 }
719no_iconv:
720#endif
677 str = av_malloc(len + 1);721 str = av_malloc(len + 1);
678 if (!str)722 if (!str)
679 return NULL;723 return NULL;
libavformat/version.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
33// Also please add any ticket numbers that you believe might be affected here33// Also please add any ticket numbers that you believe might be affected here
34#define LIBAVFORMAT_VERSION_MAJOR 5834#define LIBAVFORMAT_VERSION_MAJOR 58
35#define LIBAVFORMAT_VERSION_MINOR 2635#define LIBAVFORMAT_VERSION_MINOR 26
36#define LIBAVFORMAT_VERSION_MICRO 10036#define LIBAVFORMAT_VERSION_MICRO 101
37 37
38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
39 LIBAVFORMAT_VERSION_MINOR, \39 LIBAVFORMAT_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t