Changeset 6192caae4a74f735df9d831cd0802af91a1f7bfc

Show
Ignore:
Timestamp:
13/09/06 08:22:23 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1158128543 +0000
git-parent:

[5a3ae4a1483a0836450623f66b4a8eeca3186464]

git-author:
Clément Stenac <zorglub@videolan.org> 1158128543 +0000
Message:

* Handle parameters in streaming profiles
* Remove i18n_string stuff

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_common.h

    r0b1d6a5 r6192caa  
    336336typedef struct sap_handler_t sap_handler_t; 
    337337 
     338typedef struct sout_param_t sout_param_t; 
     339typedef struct sout_pcat_t sout_pcat_t; 
    338340typedef struct sout_std_t sout_std_t; 
    339341typedef struct sout_display_t sout_display_t; 
     
    370372typedef struct device_probe_t device_probe_t; 
    371373typedef struct probe_sys_t probe_sys_t; 
    372 typedef struct localized_string_t localized_string_t; 
    373 typedef struct i18n_string_t i18n_string_t; 
    374374 
    375375/* block */ 
  • include/vlc_streaming.h

    r1fc13bd r6192caa  
    2727#include <vlc/vlc.h> 
    2828 
     29/*********************************************************************** 
     30 * Predefined lists of streaming data 
     31 ***********************************************************************/ 
     32 
    2933#ifdef WIN32 
    3034#define VCODECS_NUMBER 13 
     
    3943enum 
    4044{ 
    41     MUX_PS, 
    42     MUX_TS, 
    43     MUX_MPEG, 
    44     MUX_OGG, 
    45     MUX_RAW, 
    46     MUX_ASF, 
    47     MUX_AVI, 
    48     MUX_MP4, 
    49     MUX_MOV, 
    50     MUX_WAV, 
    51 }; 
    52  
    53 enum 
    54 
    55     ACCESS_HTTP, 
    56     ACCESS_UDP, 
    57     ACCESS_MMS, 
    58     ACCESS_RTP, 
    59     ACCESS_FILE 
    60 }; 
     45    MUX_PS, MUX_TS, MUX_MPEG, MUX_OGG, MUX_RAW, 
     46    MUX_ASF, MUX_AVI, MUX_MP4, MUX_MOV, MUX_WAV, 
     47}; 
     48 
     49enum { ACCESS_HTTP, ACCESS_UDP, ACCESS_MMS, ACCESS_RTP, ACCESS_FILE }; 
    6150 
    6251struct codec_desc_t { 
     
    9483//static const char *abitrates_array[] = 
    9584//{ "512", "256", "192", "128", "96", "64", "32", "16" } ; 
    96  
     85// 
     86 
     87 
     88/*********************************************************************** 
     89 * Streaming profiles 
     90 ***********************************************************************/ 
     91 
     92/****************** Parameters handling *********************/ 
     93struct sout_param_t 
     94
     95    int i_type; 
     96    int i_element; 
     97    char *psz_id; 
     98    char *psz_string; 
     99    vlc_value_t value; 
     100}; 
     101 
     102struct sout_pcat_t 
     103
     104    char *psz_name; 
     105    int i_params; 
     106    sout_param_t **pp_params; 
     107}; 
     108 
     109void streaming_ParameterApply( sout_param_t *p_param, char **ppsz_dest, 
     110                           int *pi_dest, float *pf_dest, vlc_bool_t *pb_dest ); 
     111 
     112 
     113/******** Module types definitions and parametrable elements ***************/ 
     114 
     115/* Transcode */ 
     116enum { I_VB, I_AB, I_CHANNELS, F_SCALE, B_SOVERLAY, PSZ_VC, PSZ_AC, PSZ_SC, 
     117       PSZ_VE, PSZ_AE }; 
    97118struct sout_transcode_t 
    98119{ 
     
    102123    char *psz_vcodec, *psz_acodec, *psz_scodec, *psz_venc, *psz_aenc; 
    103124    char *psz_additional; 
    104 }; 
    105  
    106 struct sout_std_t  
     125 
     126    int i_params; sout_param_t **pp_params; 
     127}; 
     128void streaming_TranscodeParametersApply( sout_transcode_t *p_module ); 
     129 
     130/* Standard */ 
     131enum { PSZ_MUX, PSZ_ACCESS, PSZ_URL, PSZ_NAME, PSZ_GROUP }; 
     132struct sout_std_t 
    107133{ 
    108134    char *psz_mux, *psz_access; 
    109135    char *psz_url, *psz_name, *psz_group; 
    110 }; 
    111  
    112 struct sout_display_t  
    113 
    114 }; 
    115  
     136    int i_params; sout_param_t **pp_params; 
     137}; 
     138void streaming_StdParametersApply( sout_std_t *p_module ); 
     139 
     140/* Display */ 
     141struct sout_display_t 
     142
     143}; 
     144 
     145/* Duplicate */ 
    116146struct sout_duplicate_t 
    117147{ 
     
    121151}; 
    122152 
     153/******* Generic profile structures and manipulation functions ********/ 
    123154typedef union 
    124155{ 
     
    129160} sout_module_type_t; 
    130161 
    131  
    132162struct sout_module_t 
    133163{ 
     
    137167}; 
    138168 
    139 enum 
    140 
    141     SOUT_MOD_TRANSCODE, 
    142     SOUT_MOD_STD, 
    143     SOUT_MOD_RTP, 
    144     SOUT_MOD_DUPLICATE, 
    145     SOUT_MOD_DISPLAY 
    146 }; 
     169enum { SOUT_MOD_TRANSCODE, SOUT_MOD_STD, SOUT_MOD_RTP, SOUT_MOD_DUPLICATE, 
     170       SOUT_MOD_DISPLAY }; 
    147171 
    148172struct sout_chain_t 
     
    153177    int i_options; 
    154178    char **ppsz_options; 
    155 }; 
    156  
    157 struct sout_gui_descr_t  
     179 
     180    int i_pcats; 
     181    sout_pcat_t **pp_pcats; 
     182}; 
     183 
     184static inline sout_chain_t *streaming_ChainNew() 
     185
     186    DECMALLOC_NULL( p_chain, sout_chain_t ); 
     187    memset( p_chain, 0, sizeof( sout_chain_t ) ); 
     188    p_chain->i_options = 0; 
     189    return p_chain; 
     190
     191 
     192struct streaming_profile_t 
     193
     194    char *psz_title; 
     195    char *psz_description; 
     196    sout_chain_t *p_chain; 
     197}; 
     198 
     199/**************** GUI interaction *****************/ 
     200struct sout_gui_descr_t 
    158201{ 
    159202    /* Access */ 
     
    177220}; 
    178221 
    179 struct streaming_profile_t  
    180 
    181     i18n_string_t *p_title; 
    182     i18n_string_t *p_description; 
    183     sout_chain_t *p_chain; 
    184 }; 
    185  
    186 static inline sout_chain_t *streaming_ChainNew() 
    187 
    188     DECMALLOC_NULL( p_chain, sout_chain_t ); 
    189     memset( p_chain, 0, sizeof( sout_chain_t ) ); 
    190     p_chain->i_options = 0; 
    191     return p_chain; 
    192 
    193  
     222/***************** Profile parsing ***********************/ 
    194223 
    195224struct profile_parser_t 
     
    199228}; 
    200229 
    201  
    202  
    203 //VLC_XEXPORT( char *, streaming_ChainToPsz, (sout_chain_t * ) ); 
    204  
    205230#endif 
  • include/vlc_strings.h

    r89471fa r6192caa  
    3535VLC_EXPORT( char *, convert_xml_special_chars, ( const char *psz_content ) ); 
    3636 
    37 struct localized_string_t  
    38 { 
    39     char *psz_lang; 
    40     char *psz_text; 
    41 }; 
    42  
    43 struct i18n_string_t 
    44 { 
    45     int i_langs; 
    46     localized_string_t **pp_langs; 
    47 }; 
    48  
    49 static inline void i18n_AddLang( i18n_string_t *p_src, 
    50                                  char *psz_lang, char *psz_text ) 
    51 { 
    52     DECMALLOC_VOID( pl10n, localized_string_t ); 
    53     pl10n->psz_lang = strdup( psz_lang ); 
    54     pl10n->psz_text = strdup( psz_text ); 
    55     INSERT_ELEM( p_src->pp_langs, p_src->i_langs, p_src->i_langs, pl10n ); 
    56 }; 
    57  
    58 static inline char *i18n_Get( i18n_string_t *p_src, char *psz_lang ) 
    59 { 
    60     int i; 
    61     for( i = 0 ; i < p_src->i_langs; i++ ) 
    62     { 
    63         if( !strcmp( p_src->pp_langs[i]->psz_lang, psz_lang ) ) 
    64             return p_src->pp_langs[i]->psz_text; 
    65     } 
    66     return strdup( "" ); 
    67 }; 
    68  
    6937/** 
    7038 * @} 
  • src/stream_output/profiles.c

    r2c019e4 r6192caa  
    55 * $Id$ 
    66 * 
    7  * Authors: Clent Stenac <zorglub@videolan.org> 
     7 * Authors: Clément Stenac <zorglub@videolan.org> 
    88 * 
    99 * This program is free software; you can redistribute it and/or modify 
     
    3838 * General chain manipulation 
    3939 **********************************************************************/ 
     40/** Add a new duplicate element to a streaming chain 
     41 * \return the new element 
     42 */ 
    4043sout_duplicate_t *streaming_ChainAddDup( sout_chain_t *p_chain ) 
    4144{ 
     
    4548    DUPM->i_children = 0; 
    4649    DUPM->pp_children = NULL; 
    47     INSERT_ELEM( p_chain->pp_modules, p_chain->i_modules, p_chain->i_modules, 
    48                  p_module ); 
    49     return p_module->typed.p_duplicate; 
    50 
    51  
     50    TAB_APPEND( p_chain->i_modules, p_chain->pp_modules, p_module ); 
     51    return DUPM; 
     52
     53 
     54/** Add a new standard element to a streaming chain 
     55 * \return the new element 
     56 */ 
    5257sout_std_t *streaming_ChainAddStd( sout_chain_t *p_chain, char *psz_access, 
    5358                                   char *psz_mux, char *psz_url ) 
     
    5964    STDM->psz_access = strdup( psz_access ); 
    6065    STDM->psz_url = strdup( psz_url ); 
    61     INSERT_ELEM( p_chain->pp_modules, p_chain->i_modules, p_chain->i_modules, 
    62                  p_module ); 
     66    TAB_APPEND( p_chain->i_modules, p_chain->pp_modules, p_module ); 
    6367    return STDM; 
    6468} 
    65  
     69/** Add a new display element to a streaming chain 
     70 * \return the new element 
     71 */ 
    6672sout_display_t *streaming_ChainAddDisplay( sout_chain_t *p_chain ) 
    6773{ 
     
    6975    MALLOC_NULL( DISM, sout_display_t ); 
    7076    p_module->i_type = SOUT_MOD_DISPLAY; 
     77    TAB_APPEND( p_chain->i_modules, p_chain->pp_modules, p_module ); 
    7178    return DISM; 
    7279} 
    7380 
     81/** Add a new transcode element to a streaming chain 
     82 * \return the new element 
     83 */ 
    7484sout_transcode_t *streaming_ChainAddTranscode( sout_chain_t *p_chain, 
    7585                        char *psz_vcodec, char * psz_acodec, char * psz_scodec, 
    76                         int i_vb, float f_scale, int i_ab, int i_channels,  
     86                        int i_vb, float f_scale, int i_ab, int i_channels, 
    7787                        vlc_bool_t b_soverlay, char *psz_additional ) 
    7888{ 
     
    8898    TRAM->i_channels = i_channels; TRAM->b_soverlay = b_soverlay; 
    8999    if( TRAM->psz_additional ) TRAM->psz_additional = strdup( psz_additional ); 
     100    TAB_APPEND( p_chain->i_modules, p_chain->pp_modules, p_module ); 
    90101    return TRAM; 
    91102} 
    92              
     103 
     104/** Add a new clean child chain to an existing duplicate element */ 
    93105void streaming_DupAddChild( sout_duplicate_t *p_dup ) 
    94106{ 
    95     if( p_dup ) 
    96     { 
    97         sout_chain_t * p_child = streaming_ChainNew(); 
    98         INSERT_ELEM( p_dup->pp_children, p_dup->i_children, 
    99                      p_dup->i_children, p_child ); 
    100     } 
     107    assert( p_dup ); 
     108    sout_chain_t * p_child = streaming_ChainNew(); 
     109    TAB_APPEND( p_dup->i_children, p_dup->pp_children, p_child ); 
    101110} 
    102111 
     
    109118    free( psz_opt ); } 
    110119 
     120/** Clean up a chain (recursively if it has some children) */ 
    111121void streaming_ChainClean( sout_chain_t *p_chain ) 
    112122{ 
     
    123133                if( DUPM->i_children == 0 ) break; 
    124134                for( j = DUPM->i_children - 1 ; j >= 0; j-- ) 
    125                 { 
    126135                    streaming_ChainClean( DUPM->pp_children[j] ); 
    127                 } 
    128136                break; 
    129137            case SOUT_MOD_STD: 
     
    143151            REMOVE_ELEM( p_chain->pp_modules, p_chain->i_modules, i ); 
    144152            free( p_module ); 
     153        } 
     154    } 
     155} 
     156 
     157/********************************************************************** 
     158 * Parameters handling 
     159 **********************************************************************/ 
     160 
     161#define APPLY_PSZ( element, field ) case element: \ 
     162streaming_ParameterApply( p_param, &p_module->field, NULL, NULL, NULL ); break; 
     163#define APPLY_INT( element, field ) case element: \ 
     164streaming_ParameterApply( p_param, NULL, &p_module->field, NULL, NULL ); break; 
     165#define APPLY_FLOAT( element, field ) case element: \ 
     166streaming_ParameterApply( p_param, NULL, NULL, &p_module->field, NULL ); break; 
     167#define APPLY_BOOL( element, field ) case element: \ 
     168streaming_ParameterApply( p_param, NULL, NULL, NULL, &p_module->field ); break; 
     169 
     170/** Apply the parameters for the Std module. It will copy the values from 
     171 * the parameters to the fields themselves 
     172 */ 
     173void streaming_StdParametersApply( sout_std_t *p_module ) 
     174{ 
     175    int i; 
     176    for( i = 0 ; i< p_module->i_params; i++ ) 
     177    { 
     178        sout_param_t *p_param = p_module->pp_params[i]; 
     179        switch( p_param->i_element ) 
     180        { 
     181            APPLY_PSZ( PSZ_MUX, psz_mux ); 
     182            APPLY_PSZ( PSZ_ACCESS, psz_access ); 
     183            APPLY_PSZ( PSZ_URL, psz_url ); 
     184            APPLY_PSZ( PSZ_NAME, psz_name ); 
     185            APPLY_PSZ( PSZ_GROUP, psz_group ); 
     186        } 
     187    } 
     188} 
     189 
     190/** Apply the parameters for the Transcode module. It will copy the values from 
     191 * the parameters to the fields themselves 
     192 */ 
     193void streaming_TranscodeParametersApply( sout_transcode_t *p_module ) 
     194{ 
     195    int i; 
     196    for( i = 0 ; i< p_module->i_params; i++ ) 
     197    { 
     198        sout_param_t *p_param = p_module->pp_params[i]; 
     199        switch( p_param->i_element ) 
     200        { 
     201            APPLY_INT( I_VB, i_vb ); APPLY_INT( I_AB, i_ab ); 
     202            APPLY_INT( I_CHANNELS, i_channels ) ; 
     203            APPLY_FLOAT( F_SCALE, f_scale ); 
     204            APPLY_BOOL( B_SOVERLAY, b_soverlay ); 
     205            APPLY_PSZ( PSZ_VC, psz_vcodec ); 
     206            APPLY_PSZ( PSZ_AC, psz_acodec ); 
     207            APPLY_PSZ( PSZ_SC, psz_scodec ); 
     208            APPLY_PSZ( PSZ_VE, psz_venc ); APPLY_PSZ( PSZ_AE, psz_aenc ); 
     209        } 
     210    } 
     211} 
     212 
     213/** Apply a single parameter 
     214 * \param p_param the parameter to apply 
     215 * \param ppsz_dest target string, if param is a string 
     216 * \param pi_dest target int, if param is an integer 
     217 * \param pf_dest target float, if param is a float 
     218 * \param pb_dest target bool, if param is a bool 
     219 */ 
     220void streaming_ParameterApply( sout_param_t *p_param, char **ppsz_dest, 
     221                             int *pi_dest, float *pf_dest, vlc_bool_t *pb_dest ) 
     222{ 
     223    /* Todo : Handle psz_string like formatting */ 
     224    if( p_param->psz_string ) 
     225    { 
     226        assert( ppsz_dest ); 
     227        fprintf( stderr, "Unsupported !\n" ); 
     228    } 
     229    else 
     230    { 
     231        switch( p_param->i_type ) 
     232        { 
     233        case VLC_VAR_INTEGER: 
     234            assert( pi_dest ); 
     235            *pi_dest = p_param->value.i_int; 
     236            break; 
     237        case VLC_VAR_FLOAT: 
     238            assert( pf_dest ); 
     239            *pf_dest = p_param->value.f_float; 
     240            break; 
     241        case VLC_VAR_STRING: 
     242            assert( ppsz_dest ); 
     243            FREENULL( **ppsz_dest ); 
     244            *ppsz_dest = p_param->value.psz_string ? 
     245                                strdup( p_param->value.psz_string ) : 
     246                                NULL; 
     247            break; 
     248        case VLC_VAR_BOOL: 
     249            assert( pb_dest ); 
     250            *pb_dest = p_param->value.b_bool; 
     251            break; 
    145252        } 
    146253    } 
     
    174281 
    175282/** 
    176  * Try to convert a chain to a gui descriptor. This is only possible for  
    177  * "simple" chains.  
     283 * Try to convert a chain to a gui descriptor. This is only possible for 
     284 * "simple" chains. 
    178285 * \param p_this vlc object 
    179286 * \param p_chain the source streaming chain 
     
    204311    { 
    205312        p_module = p_chain->pp_modules[i_last]; 
    206          
     313 
    207314        // Nothing allowed after duplicate. Duplicate mustn't be empty 
    208         if( p_chain->i_modules > i_last +1 || !DUPM->i_children )  
     315        if( p_chain->i_modules > i_last +1 || !DUPM->i_children ) 
    209316            return VLC_FALSE; 
    210317        for( j = 0 ; j<  DUPM->i_children ; j++ ) 
     
    275382        streaming_ChainAddTranscode( p_chain, pd->psz_vcodec, pd->psz_acodec, 
    276383                                     pd->psz_scodec, pd->i_vb, pd->f_scale, 
    277                                      pd->i_ab, pd->i_channels,  
     384                                     pd->i_ab, pd->i_channels, 
    278385                                     pd->b_soverlay, NULL ); 
    279386    } 
    280387    /* #std{} */ 
    281     if( pd->b_local + pd->b_file + pd->b_http + pd->b_mms + pd->b_rtp +  
     388    if( pd->b_local + pd->b_file + pd->b_http + pd->b_mms + pd->b_rtp + 
    282389        pd->b_udp > 1 ) 
    283390    { 
     
    316423        { 
    317424            pd->b_sap = VLC_TRUE; 
    318             p_std->psz_name = strdup( pd->psz_name );        
     425            p_std->psz_name = strdup( pd->psz_name ); 
    319426            p_std->psz_group = pd->psz_group ? strdup( pd->psz_group ) : NULL; 
    320427        } 
     
    380487/** 
    381488 * List the available profiles. Fills the pp_profiles list with preinitialized 
    382  * values. Only metadata is decoded 
     489 * values. 
    383490 * \param p_this vlc object 
    384491 * \param pi_profiles number of listed profiles 
    385492 * \param pp_profiles array of profiles 
    386493 */ 
    387 void streaming_ProfilesList( vlc_object_t *p_this, int *pi_profiles,  
     494void streaming_ProfilesList( vlc_object_t *p_this, int *pi_profiles, 
    388495                             streaming_profile_t **pp_profiles ) 
    389496{