Ticket #2481: dvb-na-cc-r11313-v2.patch
File dvb-na-cc-r11313-v2.patch, 5.4 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/avformatdecoder.cpp
2956 2956 DecodeDTVCC(mpa_pic.atsc_cc_buf + i); 2957 2957 } 2958 2958 2959 // Decode DVB captions from MPEG user data 2960 if (mpa_pic.dvb_cc_len > 0) { 2961 unsigned long long utc = lastccptsu; 2962 2963 for (uint i = 0; i < (uint)mpa_pic.dvb_cc_len; i += 2) { 2964 uint8_t cc_lo = mpa_pic.dvb_cc_data[i]; 2965 uint8_t cc_hi = mpa_pic.dvb_cc_data[i+1]; 2966 2967 uint16_t cc_dt = (cc_hi << 8) | cc_lo; 2968 2969 if (cc608_good_parity(cc608_parity_table, cc_dt)) { 2970 ccd608->FormatCCField(utc/1000, 0, cc_dt); 2971 utc += 33367; 2972 } 2973 } 2974 lastccptsu = utc; 2975 } 2976 2959 2977 VideoFrame *picframe = (VideoFrame *)(mpa_pic.opaque); 2960 2978 2961 2979 if (!directrendering) -
libs/libavcodec/mpegvideo.c
1548 1548 pic->atsc_cc_len = s->tmp_atsc_cc_len; 1549 1549 s->tmp_atsc_cc_len = 0; 1550 1550 1551 /* Put DVB captions cached from parse_user_data into the correct frame */ 1552 memcpy(pic->dvb_cc_data, s->tmp_dvb_cc_data, s->tmp_dvb_cc_len); 1553 pic->dvb_cc_len = s->tmp_dvb_cc_len; 1554 s->tmp_dvb_cc_len = 0; 1555 1551 1556 pic->reference= (s->pict_type != B_TYPE || s->codec_id == CODEC_ID_H264) 1552 1557 && !s->dropable ? 3 : 0; 1553 1558 -
libs/libavcodec/mpegvideo.h
707 707 uint8_t tmp_atsc_cc_buf[ATSC_CC_BUF_SIZE]; 708 708 int tmp_atsc_cc_len; 709 709 710 #define DVB_CC_BUF_SIZE 32 711 /// Used to hold cached user_data about certain types of DVB captions 712 uint8_t tmp_dvb_cc_data[DVB_CC_BUF_SIZE]; 713 int tmp_dvb_cc_len; 714 710 715 int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch() 711 716 #define SLICE_OK 0 712 717 #define SLICE_ERROR -1 -
libs/libavcodec/mpeg12.c
3014 3014 else if (user_data_type_code == 0x06) { 3015 3015 // bar data (letterboxing info) 3016 3016 } 3017 } else if (len >= 11 && 3018 p[0] == 0x05 && p[1] == 0x02) { 3019 p += 2; 3020 len -= 2; 3021 3022 Mpeg1Context *s1 = avctx->priv_data; 3023 MpegEncContext *s = &s1->mpeg_enc_ctx; 3024 3025 uint8_t dvb_cc_type = p[5]; 3026 p += 6; 3027 len -= 6; 3028 3029 /* Predictive frame tag, but MythTV reorders predictive 3030 * frames for us along with the CC data, so we ignore it. 3031 */ 3032 if (dvb_cc_type == 0x05) { 3033 dvb_cc_type = p[6]; 3034 p += 7; 3035 len -= 7; 3036 } 3037 3038 if (dvb_cc_type == 0x02) { /* 2-byte caption, can be repeated */ 3039 uint8_t hi = p[1] & 0xFF; 3040 uint8_t lo = p[2] & 0xFF; 3041 3042 dvb_cc_type = p[3]; 3043 3044 if ((2 <= len) && ((2 + s->tmp_dvb_cc_len) < DVB_CC_BUF_SIZE)) { 3045 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = hi; 3046 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = lo; 3047 3048 /* Only repeat characters when the next type flag 3049 * is 0x04 and the characters are repeatable (i.e., less than 3050 * 32 with the parity stripped). 3051 */ 3052 if (dvb_cc_type == 0x04 && (hi & 0x7f) < 32) { 3053 if ((4 <= len) && 3054 ((4 + s->tmp_dvb_cc_len) < DVB_CC_BUF_SIZE)) { 3055 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = hi; 3056 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = lo; 3057 } 3058 } 3059 } 3060 3061 p += 6; 3062 len -= 6; 3063 } else if (dvb_cc_type == 0x04) { /* 4-byte caption, not repeated */ 3064 if ((4 <= len) && ((4 + s->tmp_dvb_cc_len) < DVB_CC_BUF_SIZE)) { 3065 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = p[1] & 0xFF; 3066 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = p[2] & 0xFF; 3067 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = p[3] & 0xFF; 3068 s->tmp_dvb_cc_data[s->tmp_dvb_cc_len++] = p[4] & 0xFF; 3069 } 3070 3071 p += 9; 3072 len -= 9; 3073 } 3017 3074 } 3018 3075 } 3019 3076 -
libs/libavcodec/avcodec.h
667 667 uint8_t atsc_cc_buf[1024];\ 668 668 int atsc_cc_len;\ 669 669 \ 670 /** DVB CC data\ 671 * - encoding: unused\ 672 * - decoding: set by lavc\ 673 */\ 674 uint8_t dvb_cc_data[32];\ 675 int dvb_cc_len;\ 676 \ 670 677 671 678 #define FF_QSCALE_TYPE_MPEG1 0 672 679 #define FF_QSCALE_TYPE_MPEG2 1