Changeset db7c88851fa45ecc3160a27f9a26e2f62b589baa

Show
Ignore:
Timestamp:
01/19/07 19:26:39 (2 years ago)
Author:
Christophe Massiot <massiot@videolan.org>
git-committer:
Christophe Massiot <massiot@videolan.org> 1169231199 +0000
git-parent:

[e92542211f05387f69987541df48ac25d480e878]

git-author:
Christophe Massiot <massiot@videolan.org> 1169231199 +0000
Message:
  • modules/demux/ts.c: Parse the telx descriptor and create pseudo ES
    for different languages. Slightly changed the way the dvbsub parser
    works to allow correct streaming with --sout-all or --programs.
  • modules/mux/mpeg/ts.c: Changes to allow descriptor pass-through with
    telx and dvbsub. This is kind of kludgy.
  • module/codec/telx.c: Got rid of the ugly static variables and use
    info from the TS demux.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/codec/telx.c

    re925422 rdb7c888  
    4242 
    4343/***************************************************************************** 
    44  * Local prototypes 
    45  *****************************************************************************/ 
    46 static int telx_conf_cb ( vlc_object_t *,      /* variable's object */ 
    47                           char const *,            /* variable name */ 
    48                           vlc_value_t,                 /* old value */ 
    49                           vlc_value_t,                 /* new value */ 
    50                           void * );                /* callback data */ 
    51  
    52 /***************************************************************************** 
    5344 * Module descriptor. 
    5445 *****************************************************************************/ 
     
    5748static subpicture_t *Decode( decoder_t *, block_t ** ); 
    5849 
    59  
    60 #define PAGE_TEXT N_("Teletext page") 
    61 #define PAGE_LONGTEXT N_("Set displayed teletext page for subtitles, 0 for all pages, 888 should be a standard value. Just leave it to zero if your stream has only one language for subtitles.") 
     50#define OVERRIDE_PAGE_TEXT N_("Override page") 
     51#define OVERRIDE_PAGE_LONGTEXT N_("Override the indicated page, try this if " \ 
     52        "your subtitles don't appear (0 = autodetect, usually 888 or 889).") 
    6253 
    6354#define IGNORE_SUB_FLAG_TEXT N_("Ignore subtitle flag") 
    64 #define IGNORE_SUB_FLAG_LONGTEXT N_("Ignore the subtitle flag, try this if your subtitles don't appear.") 
     55#define IGNORE_SUB_FLAG_LONGTEXT N_("Ignore the subtitle flag, try this if " \ 
     56        "your subtitles don't appear.") 
    6557 
    6658vlc_module_begin(); 
     
    7264    set_callbacks( Open, Close ); 
    7365 
    74     add_integer( "telx-page", 0, telx_conf_cb, PAGE_TEXT, PAGE_LONGTEXT
    75                  VLC_FALSE ); 
    76     add_bool( "telx-ignore-subtitle-flag", 0, telx_conf_cb
     66    add_integer( "telx-override-page", -1, NULL
     67                 OVERRIDE_PAGE_TEXT, OVERRIDE_PAGE_LONGTEXT, VLC_TRUE ); 
     68    add_bool( "telx-ignore-subtitle-flag", 0, NULL
    7769              IGNORE_SUB_FLAG_TEXT, IGNORE_SUB_FLAG_LONGTEXT, VLC_TRUE ); 
    7870 
     
    9385  vlc_bool_t  b_erase[9]; 
    9486  uint16_t *  pi_active_national_set[9]; 
     87  int         i_wanted_page, i_wanted_magazine; 
     88  vlc_bool_t  b_ignore_sub_flag; 
    9589}; 
    9690 
     
    9892 * Local data 
    9993 ****************************************************************************/ 
    100  
    101 static int i_conf_wanted_page = 0; /* default 0 = all pages */ 
    102 static vlc_bool_t b_ignore_sub_flag = 0; 
    10394 
    10495/* 
     
    189180        p_sys->pi_active_national_set[i] = ppi_national_subsets[1]; 
    190181 
    191     var_Create( p_dec, "telx-page", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); 
    192     var_Get( p_dec, "telx-page", &val ); 
    193     i_conf_wanted_page = val.i_int; 
     182    var_Create( p_dec, "telx-override-page", 
     183                VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 
     184    var_Get( p_dec, "telx-override-page", &val ); 
     185    if( val.i_int == -1 ) 
     186    { 
     187        p_sys->i_wanted_magazine = p_dec->fmt_in.subs.dvb.i_id >> 16; 
     188        if( p_sys->i_wanted_magazine == 0 ) 
     189            p_sys->i_wanted_magazine = 8; 
     190        p_sys->i_wanted_page = p_dec->fmt_in.subs.dvb.i_id & 0xff; 
     191    } 
     192    else if( val.i_int == 0 ) 
     193    { 
     194        p_sys->i_wanted_magazine = -1; 
     195        p_sys->i_wanted_page = -1; 
     196    } 
     197    else 
     198    { 
     199        p_sys->i_wanted_magazine = val.i_int / 100; 
     200        p_sys->i_wanted_page = (((val.i_int % 100) / 10) << 4) 
     201                                | ((val.i_int % 100) % 10); 
     202    } 
    194203 
    195204    var_Create( p_dec, "telx-ignore-subtitle-flag", 
    196205                VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 
    197206    var_Get( p_dec, "telx-ignore-subtitle-flag", &val ); 
    198     b_ignore_sub_flag = val.b_bool; 
     207    p_sys->b_ignore_sub_flag = val.b_bool; 
     208 
     209    msg_Dbg( p_dec, "starting telx on magazine %d page %x flag %d", 
     210             p_sys->i_wanted_magazine, p_sys->i_wanted_page, 
     211             p_sys->b_ignore_sub_flag ); 
    199212 
    200213    return VLC_SUCCESS; 
     
    207220/*     return VLC_EGENERIC; */ 
    208221} 
    209  
    210 /***************************************************************************** 
    211  * Config callback 
    212  *****************************************************************************/ 
    213 static int telx_conf_cb ( vlc_object_t * obj,      /* variable's object */ 
    214                           char const * name,       /* variable name */ 
    215                           vlc_value_t oldv,        /* old value */ 
    216                           vlc_value_t newv,        /* new value */ 
    217                           void * data)             /* callback data */ 
    218 { 
    219     if ( !strcmp(name, "telx-page") ) 
    220     { 
    221         i_conf_wanted_page = newv.i_int; 
    222         dbg((obj, "display teletext page changed to %d\n", i_conf_wanted_page)); 
    223     } 
    224     else if ( !strcmp(name, "telx-ignore-subtitle-flag") ) 
    225     { 
    226         b_ignore_sub_flag = newv.b_bool; 
    227         dbg((obj, "ignore sub flag changed to %d\n", (int) b_ignore_sub_flag)); 
    228     } 
    229  
    230     return 0; 
    231 } 
    232  
    233222 
    234223/***************************************************************************** 
     
    431420    /* int erase = 0; */ 
    432421    int len, offset; 
     422#if 0 
    433423    int i_wanted_magazine = i_conf_wanted_page / 100; 
    434424    int i_wanted_page = 0x10 * ((i_conf_wanted_page % 100) / 10) 
    435425                         | (i_conf_wanted_page % 10); 
     426#endif 
    436427    vlc_bool_t b_update = VLC_FALSE; 
    437428    char psz_text[512], *pt = psz_text; 
     
    473464        row >>= 3; 
    474465 
    475         if ( i_conf_wanted_page && magazine != i_wanted_magazine ) continue; 
     466        if ( p_sys->i_wanted_page != -1 
     467              && magazine != p_sys->i_wanted_magazine ) 
     468            continue; 
    476469 
    477470        if ( row == 0 ) 
     
    487480            } 
    488481 
    489     /*         if (!b_ignore_sub_flag && !(1 & flag>>15)) */ 
     482    /*         if (!p_sys->b_ignore_sub_flag && !(1 & flag>>15)) */ 
    490483    /*           continue; */ 
    491484 
     
    503496                                 ppi_national_subsets[7 & (flag >> 21)]; 
    504497 
    505             p_sys->b_is_subtitle[magazine] = b_ignore_sub_flag 
     498            p_sys->b_is_subtitle[magazine] = p_sys->b_ignore_sub_flag 
    506499                                              || ( (1 & (flag >> 15)) 
    507500                                                  && (1 & (flag>>16)) ); 
     
    517510                  (1 & (flag>>20)) )); 
    518511            
    519             if ( (i_conf_wanted_page && p_sys->i_page[magazine] != i_wanted_page) 
     512            if ( (p_sys->i_wanted_page != -1 
     513                   && p_sys->i_page[magazine] != p_sys->i_wanted_page) 
    520514                   || !p_sys->b_is_subtitle[magazine] ) 
    521515                continue; 
     
    561555            /* row 1-23 : normal lines */ 
    562556 
    563             if ( (i_conf_wanted_page && p_sys->i_page[magazine] != i_wanted_page) 
     557            if ( (p_sys->i_wanted_page != -1 
     558                   && p_sys->i_page[magazine] != p_sys->i_wanted_page) 
    564559                   || !p_sys->b_is_subtitle[magazine]  
    565                    || (!i_conf_wanted_page && p_sys->i_page[magazine] > 0x99) ) 
     560                   || (p_sys->i_wanted_page == -1 
     561                        && p_sys->i_page[magazine] > 0x99) ) 
    566562                continue; 
    567563 
     
    616612        { 
    617613            /* row 25 : alternate header line */ 
    618             if ( (i_conf_wanted_page && p_sys->i_page[magazine] != i_wanted_page) 
     614            if ( (p_sys->i_wanted_page != -1 
     615                   && p_sys->i_page[magazine] != p_sys->i_wanted_page) 
    619616                   || !p_sys->b_is_subtitle[magazine] ) 
    620617                continue; 
  • modules/demux/ts.c

    r80fde19 rdb7c888  
    26562656#endif 
    26572657    if( p_demux->p_sys->pid[0].psi->i_pat_version == -1 ) 
    2658    return; 
     2658        return; 
    26592659 
    26602660    if( i_table_id == 0x42 ) 
     
    30173017                    pid->es->fmt.i_cat = SPU_ES; 
    30183018                    pid->es->fmt.i_codec = VLC_FOURCC( 't', 'e', 'l', 'x' ); 
    3019                     pid->es->fmt.psz_description = strdup( "Teletext" ); 
    30203019                    pid->es->fmt.i_extra = p_dr->i_length; 
    30213020                    pid->es->fmt.p_extra = malloc( p_dr->i_length ); 
    30223021                    memcpy( pid->es->fmt.p_extra, p_dr->p_data, 
    30233022                            p_dr->i_length ); 
    3024                 } 
    3025 #ifdef _DVBPSI_DR_59_H_ 
     3023 
     3024#ifdef _DVBPSI_DR_56_H_ 
     3025                    pid->es->fmt.i_group = p_pmt->i_program_number; 
     3026 
     3027                    /* If i_dvb_program == -1 it means the user specified 
     3028                     * --sout-all or --programs, so she want to stream, and 
     3029                     * she doesn't want to stream several identical ESes 
     3030                     * with different language descriptors. So for -1 we 
     3031                     * just enable descriptor pass-through. --Meuuh */ 
     3032                    if( p_sys->i_dvb_program != -1 ) 
     3033                    { 
     3034                        uint16_t n, i = 0; 
     3035                        dvbpsi_teletext_dr_t *sub; 
     3036 
     3037                        sub = dvbpsi_DecodeTeletextDr( p_dr ); 
     3038                        if( !sub ) continue; 
     3039 
     3040                        /* Each subtitle ES contains n languages, 
     3041                         * We are going to create n ES for the n tracks */ 
     3042                        for( n = 0; n < sub->i_pages_number; n++ ) 
     3043                        { 
     3044                            dvbpsi_teletextpage_t *p_page = &sub->p_pages[n]; 
     3045                            if( p_page->i_teletext_type == 0x2 
     3046                                 || p_page->i_teletext_type == 0x5 ) 
     3047                            { 
     3048                                ts_es_t *p_es; 
     3049 
     3050                                if( i == 0 ) 
     3051                                { 
     3052                                    p_es = pid->es; 
     3053                                } 
     3054                                else 
     3055                                { 
     3056                                    p_es = malloc( sizeof( ts_es_t ) ); 
     3057                                    p_es->fmt = pid->es->fmt; 
     3058                                    p_es->id = NULL; 
     3059                                    p_es->p_pes = NULL; 
     3060                                    p_es->i_pes_size = 0; 
     3061                                    p_es->i_pes_gathered = 0; 
     3062                                    p_es->pp_last = &p_es->p_pes; 
     3063                                    p_es->p_mpeg4desc = NULL; 
     3064 
     3065                                    TAB_APPEND( pid->i_extra_es, pid->extra_es, 
     3066                                                p_es ); 
     3067                                } 
     3068 
     3069                                p_es->fmt.psz_language = malloc( 4 ); 
     3070                                memcpy( p_es->fmt.psz_language, 
     3071                                        p_page->i_iso6392_language_code, 3 ); 
     3072                                p_es->fmt.psz_language[3] = 0; 
     3073 
     3074                                switch( p_page->i_teletext_type ) 
     3075                                { 
     3076                                case 0x2: 
     3077                                    p_es->fmt.psz_description = 
     3078                                        strdup(_("subtitles")); 
     3079                                    msg_Dbg( p_demux, 
     3080                                             "    * sub lan=%s page=%d%x", 
     3081                                             p_es->fmt.psz_language, 
     3082                                             p_page->i_teletext_magazine_number, 
     3083                                             p_page->i_teletext_page_number ); 
     3084                                    break; 
     3085 
     3086                                case 0x5: 
     3087                                    p_es->fmt.psz_description = 
     3088                                        strdup(_("hearing impaired")); 
     3089                                    msg_Dbg( p_demux, 
     3090                                             "    * hearing impaired lan=%s page=%d%x", 
     3091                                             p_es->fmt.psz_language, 
     3092                                             p_page->i_teletext_magazine_number, 
     3093                                             p_page->i_teletext_page_number ); 
     3094                                    break; 
     3095                                default: 
     3096                                    break; 
     3097                                } 
     3098 
     3099                                p_es->fmt.subs.dvb.i_id = 
     3100                                    p_page->i_teletext_page_number; 
     3101                                /* Hack, FIXME */ 
     3102                                p_es->fmt.subs.dvb.i_id |= 
     3103                                ((int)p_page->i_teletext_magazine_number << 16); 
     3104 
     3105                                i++; 
     3106                            } 
     3107                        } 
     3108 
     3109                        if( !i ) 
     3110                            pid->es->fmt.i_cat = UNKNOWN_ES; 
     3111                    } 
     3112#else 
     3113                    pid->es->fmt.psz_description = strdup( "Teletext" ); 
     3114#endif 
     3115                } 
    30263116                else if( p_dr->i_tag == 0x59 ) 
    30273117                { 
    3028                     uint16_t n; 
    3029                     dvbpsi_subtitling_dr_t *sub; 
    3030  
    30313118                    /* DVB subtitles */ 
    30323119                    pid->es->fmt.i_cat = SPU_ES; 
    30333120                    pid->es->fmt.i_codec = VLC_FOURCC( 'd', 'v', 'b', 's' ); 
     3121                    pid->es->fmt.i_extra = p_dr->i_length; 
     3122                    pid->es->fmt.p_extra = malloc( p_dr->i_length ); 
     3123                    memcpy( pid->es->fmt.p_extra, p_dr->p_data, 
     3124                            p_dr->i_length ); 
     3125 
     3126#ifdef _DVBPSI_DR_59_H_ 
    30343127                    pid->es->fmt.i_group = p_pmt->i_program_number; 
    30353128 
    3036                     sub = dvbpsi_DecodeSubtitlingDr( p_dr ); 
    3037                     if( !sub ) continue; 
    3038  
    3039                     /* Each subtitle ES contains n languages, 
    3040                      * We are going to create n ES for the n tracks */ 
    3041                     if( sub->i_subtitles_number > 0
     3129                    /* If i_dvb_program == -1 it means the user specified 
     3130                    * --sout-all or --programs, so she want to stream, and 
     3131                     * she doesn't want to stream several identical ESes 
     3132                    * with different language descriptors. So for -1 we 
     3133                     * just enable descriptor pass-through. --Meuuh */ 
     3134                    if( p_sys->i_dvb_program != -1
    30423135                    { 
    3043                         pid->es->fmt.psz_language = malloc( 4 ); 
    3044                         memcpy( pid->es->fmt.psz_language, 
    3045                                 sub->p_subtitle[0].i_iso6392_language_code, 3); 
    3046                         pid->es->fmt.psz_language[3] = 0; 
    3047  
    3048                         pid->es->fmt.subs.dvb.i_id = 
    3049                             sub->p_subtitle[0].i_composition_page_id; 
    3050                         /* Hack, FIXME */ 
    3051                         pid->es->fmt.subs.dvb.i_id |= 
    3052                           ((int)sub->p_subtitle[0].i_ancillary_page_id << 16); 
     3136                        uint16_t n, i = 0; 
     3137                        dvbpsi_subtitling_dr_t *sub; 
     3138 
     3139                        sub = dvbpsi_DecodeSubtitlingDr( p_dr ); 
     3140                        if( !sub ) continue; 
     3141 
     3142                        for( n = 0; n < sub->i_subtitles_number; n++ ) 
     3143                        { 
     3144                            dvbpsi_subtitle_t *p_sub = &sub->p_subtitle[n]; 
     3145                            ts_es_t *p_es; 
     3146 
     3147                            if( i == 0 ) 
     3148                            { 
     3149                                p_es = pid->es; 
     3150                            } 
     3151                            else 
     3152                            { 
     3153                                p_es = malloc( sizeof( ts_es_t ) ); 
     3154                                p_es->fmt = pid->es->fmt; 
     3155                                p_es->id = NULL; 
     3156                                p_es->p_pes = NULL; 
     3157                                p_es->i_pes_size = 0; 
     3158                                p_es->i_pes_gathered = 0; 
     3159                                p_es->pp_last = &p_es->p_pes; 
     3160                                p_es->p_mpeg4desc = NULL; 
     3161 
     3162                                TAB_APPEND( pid->i_extra_es, pid->extra_es, 
     3163                                            p_es ); 
     3164                            } 
     3165 
     3166                            p_es->fmt.psz_language = malloc( 4 ); 
     3167                            memcpy( p_es->fmt.psz_language, 
     3168                                    p_sub->i_iso6392_language_code, 3 ); 
     3169                            p_es->fmt.psz_language[3] = 0; 
     3170 
     3171                            switch( p_sub->i_subtitling_type ) 
     3172                            { 
     3173                            case 0x10: 
     3174                                p_es->fmt.psz_description = 
     3175                                    strdup(_("subtitles")); 
     3176                                break; 
     3177                            case 0x11: 
     3178                                p_es->fmt.psz_description = 
     3179                                    strdup(_("4:3 subtitles")); 
     3180                                break; 
     3181                            case 0x12: 
     3182                                p_es->fmt.psz_description = 
     3183                                    strdup(_("16:9 subtitles")); 
     3184                                break; 
     3185                            case 0x13: 
     3186                                p_es->fmt.psz_description = 
     3187                                    strdup(_("2.21:1 subtitles")); 
     3188                                break; 
     3189                            case 0x20: 
     3190                                p_es->fmt.psz_description = 
     3191                                    strdup(_("hearing impaired")); 
     3192                                break; 
     3193                            case 0x21: 
     3194                                p_es->fmt.psz_description = 
     3195                                    strdup(_("4:3 hearing impaired")); 
     3196                                break; 
     3197                            case 0x22: 
     3198                                p_es->fmt.psz_description = 
     3199                                    strdup(_("16:9 hearing impaired")); 
     3200                                break; 
     3201                            case 0x23: 
     3202                                p_es->fmt.psz_description = 
     3203                                    strdup(_("2.21:1 hearing impaired")); 
     3204                                break; 
     3205                            default: 
     3206                                break; 
     3207                            } 
     3208 
     3209                            p_es->fmt.subs.dvb.i_id = 
     3210                                p_sub->i_composition_page_id; 
     3211                            /* Hack, FIXME */ 
     3212                            p_es->fmt.subs.dvb.i_id |= 
     3213                              ((int)p_sub->i_ancillary_page_id << 16); 
     3214 
     3215                            i++; 
     3216                        } 
     3217 
     3218                        if( !i ) 
     3219                            pid->es->fmt.i_cat = UNKNOWN_ES; 
    30533220                    } 
    3054                     else pid->es->fmt.i_cat = UNKNOWN_ES; 
    3055  
    3056                     for( n = 1; n < sub->i_subtitles_number; n++ ) 
    3057                     { 
    3058                         ts_es_t *p_es = malloc( sizeof( ts_es_t ) ); 
    3059                         p_es->fmt = pid->es->fmt; 
    3060                         p_es->id = NULL; 
    3061                         p_es->p_pes = NULL; 
    3062                         p_es->i_pes_size = 0; 
    3063                         p_es->i_pes_gathered = 0; 
    3064                         p_es->pp_last = &p_es->p_pes; 
    3065                         p_es->p_mpeg4desc = NULL; 
    3066  
    3067                         p_es->fmt.psz_language = malloc( 4 ); 
    3068                         memcpy( p_es->fmt.psz_language, 
    3069                                 sub->p_subtitle[n].i_iso6392_language_code, 3); 
    3070                         p_es->fmt.psz_language[3] = 0; 
    3071  
    3072                         p_es->fmt.subs.dvb.i_id = 
    3073                             sub->p_subtitle[n].i_composition_page_id; 
    3074                         /* Hack, FIXME */ 
    3075                         p_es->fmt.subs.dvb.i_id |= 
    3076                           ((int)sub->p_subtitle[n].i_ancillary_page_id << 16); 
    3077  
    3078                         TAB_APPEND( pid->i_extra_es, pid->extra_es, p_es ); 
    3079                     } 
    3080                 } 
    30813221#endif /* _DVBPSI_DR_59_H_ */ 
     3222                } 
    30823223            } 
    30833224        } 
     
    31223263        if( pid->es->fmt.i_cat == AUDIO_ES || 
    31233264            ( pid->es->fmt.i_cat == SPU_ES && 
    3124               pid->es->fmt.i_codec != VLC_FOURCC('d','v','b','s') ) ) 
     3265              pid->es->fmt.i_codec != VLC_FOURCC('d','v','b','s') && 
     3266              pid->es->fmt.i_codec != VLC_FOURCC('t','e','l','x') ) ) 
    31253267        { 
    31263268            /* get language descriptor */ 
     
    31343276                if( p_decoded ) 
    31353277                { 
    3136 #if DR_0A_API_VER >= 2 
     3278#if defined(DR_0A_API_VER) && (DR_0A_API_VER >= 2) 
    31373279                    pid->es->fmt.psz_language = malloc( 4 ); 
    31383280                    memcpy( pid->es->fmt.psz_language, 
  • modules/mux/mpeg/ts.c

    rd3fe7f2 rdb7c888  
    24982498        else if( p_stream->i_codec == VLC_FOURCC('t','e','l','x') ) 
    24992499        { 
    2500             dvbpsi_PMTESAddDescriptor( p_es, 0x56, 
    2501                                        p_stream->i_decoder_specific_info, 
    2502                                        p_stream->p_decoder_specific_info ); 
    2503         } 
     2500            if( p_stream->i_decoder_specific_info ) 
     2501            { 
     2502                dvbpsi_PMTESAddDescriptor( p_es, 0x56, 
     2503                                           p_stream->i_decoder_specific_info, 
     2504                                           p_stream->p_decoder_specific_info ); 
     2505            } 
     2506            continue; 
     2507        } 
     2508        else if( p_stream->i_codec == VLC_FOURCC('d','v','b','s') ) 
     2509        { 
     2510            /* DVB subtitles */ 
     2511            if( p_stream->i_decoder_specific_info ) 
     2512            { 
     2513                /* pass-through from the TS demux */ 
     2514                dvbpsi_PMTESAddDescriptor( p_es, 0x59, 
     2515                                           p_stream->i_decoder_specific_info, 
     2516                                           p_stream->p_decoder_specific_info ); 
     2517            } 
    25042518#ifdef _DVBPSI_DR_59_H_ 
    2505         else if( p_stream->i_codec == VLC_FOURCC('d','v','b','s') ) 
    2506         { 
    2507             /* DVB subtitles */ 
    2508             dvbpsi_subtitling_dr_t descr; 
    2509             dvbpsi_subtitle_t sub; 
    2510             dvbpsi_descriptor_t *p_descr; 
    2511  
    2512             memcpy( sub.i_iso6392_language_code, p_stream->lang, 3 ); 
    2513             sub.i_subtitling_type = 0x10; /* no aspect-ratio criticality */ 
    2514             sub.i_composition_page_id = p_stream->i_es_id & 0xFF; 
    2515             sub.i_ancillary_page_id = p_stream->i_es_id >> 16; 
    2516  
    2517             descr.i_subtitles_number = 1; 
    2518             descr.p_subtitle[0] = sub; 
    2519  
    2520             p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 ); 
    2521             /* Work around bug in old libdvbpsi */ p_descr->i_length = 8; 
    2522             dvbpsi_PMTESAddDescriptor( p_es, p_descr->i_tag, 
    2523                                        p_descr->i_length, p_descr->p_data ); 
     2519            else 
     2520            { 
     2521                /* from the dvbsub transcoder */ 
     2522                dvbpsi_subtitling_dr_t descr; 
     2523                dvbpsi_subtitle_t sub; 
     2524                dvbpsi_descriptor_t *p_descr; 
     2525 
     2526                memcpy( sub.i_iso6392_language_code, p_stream->lang, 3 ); 
     2527                sub.i_subtitling_type = 0x10; /* no aspect-ratio criticality */ 
     2528                sub.i_composition_page_id = p_stream->i_es_id & 0xFF; 
     2529                sub.i_ancillary_page_id = p_stream->i_es_id >> 16; 
     2530 
     2531                descr.i_subtitles_number = 1; 
     2532                descr.p_subtitle[0] = sub; 
     2533 
     2534                p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 ); 
     2535                /* Work around bug in old libdvbpsi */ p_descr->i_length = 8; 
     2536                dvbpsi_PMTESAddDescriptor( p_es, p_descr->i_tag, 
     2537                                           p_descr->i_length, p_descr->p_data ); 
     2538            } 
     2539#endif /* _DVBPSI_DR_59_H_ */ 
    25242540            continue; 
    25252541        } 
    2526 #endif /* _DVBPSI_DR_59_H_ */ 
    25272542 
    25282543        if( p_stream->lang[0] != 0 )