Changeset 121f3c3e7ac8cccafa0f300699b4e82af681be92

Show
Ignore:
Timestamp:
03/10/07 20:36:03 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1191436563 +0000
git-parent:

[67079185907a0df3bd3d529bf4231979e9db6bfe]

git-author:
Rafaël Carré <funman@videolan.org> 1191436563 +0000
Message:

mp4 demuxer: don't try to print not printable characters.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/mp4/libmp4.c

    r3f07af6 r121f3c3  
    111111*/ 
    112112 
     113/* This macro is used when we want to printf the box type 
     114 * APPLE annotation box is : 
     115 *  either 0xA9 + 24-bit ASCII text string (and 0xA9 isn't printable) 
     116 *  either 32-bit ASCII text string 
     117 */ 
     118#define MP4_BOX_TYPE_ASCII() ( ((char*)&p_box->i_type)[0] != (char)0xA9 ) 
     119 
    113120static uint32_t Get24bBE( const uint8_t *p ) 
    114121{ 
     
    207214    if( p_box->i_size ) 
    208215    { 
    209         msg_Dbg( p_stream, "found Box: %4.4s size "I64Fd, 
    210                  (char*)&p_box->i_type, p_box->i_size ); 
     216        if MP4_BOX_TYPE_ASCII() 
     217            msg_Dbg( p_stream, "found Box: %4.4s size "I64Fd, 
     218                    (char*)&p_box->i_type, p_box->i_size ); 
     219        else 
     220            msg_Dbg( p_stream, "found Box: c%3.3s size "I64Fd, 
     221                    (char*)&p_box->i_type+1, p_box->i_size ); 
    211222    } 
    212223#endif 
     
    339350    /* Nothing to do */ 
    340351#ifdef MP4_VERBOSE 
    341     msg_Dbg( p_stream, "skip box: \"%4.4s\"", (char*)&p_box->i_type ); 
     352    if MP4_BOX_TYPE_ASCII() 
     353        msg_Dbg( p_stream, "skip box: \"%4.4s\"", (char*)&p_box->i_type ); 
     354    else 
     355        msg_Dbg( p_stream, "skip box: \"c%3.3s\"", (char*)&p_box->i_type+1 ); 
    342356#endif 
    343357    return 1; 
     
    605619 
    606620#ifdef MP4_VERBOSE 
    607     msg_Dbg( p_stream, "read box: \"hdlr\" handler type %4.4s name %s", 
    608                        (char*)&p_box->data.p_hdlr->i_handler_type, 
    609                        p_box->data.p_hdlr->psz_name ); 
     621        msg_Dbg( p_stream, "read box: \"hdlr\" handler type %4.4s name %s", 
     622                   (char*)&p_box->data.p_hdlr->i_handler_type, 
     623                   p_box->data.p_hdlr->psz_name ); 
    610624 
    611625#endif 
     
    19611975#ifdef MP4_VERBOSE 
    19621976    msg_Dbg( p_stream, 
    1963              "read box: \"rdrf\" type:%4.4s ref %s", 
    1964              (char*)&p_box->data.p_rdrf->i_ref_type, 
    1965              p_box->data.p_rdrf->psz_ref ); 
    1966  
     1977            "read box: \"rdrf\" type:%4.4s ref %s", 
     1978            (char*)&p_box->data.p_rdrf->i_ref_type, 
     1979            p_box->data.p_rdrf->psz_ref ); 
    19671980#endif 
    19681981    MP4_READBOX_EXIT( 1 ); 
     
    20642077                default: psz_error = "unknown error"; break; 
    20652078            } 
    2066  
    2067             msg_Err( p_stream, "drms_init(%4.4s) failed (%s)", 
    2068                      (char *)&p_box->i_type, psz_error ); 
     2079            if MP4_BOX_TYPE_ASCII() 
     2080                msg_Err( p_stream, "drms_init(%4.4s) failed (%s)", 
     2081                        (char *)&p_box->i_type, psz_error ); 
     2082            else 
     2083                msg_Err( p_stream, "drms_init(c%3.3s) failed (%s)", 
     2084                        (char *)&p_box->i_type+1, psz_error ); 
    20692085 
    20702086            drms_free( p_drms_box->data.p_sample_soun->p_drms ); 
     
    23032319 
    23042320unknown: 
    2305     msg_Warn( p_stream, 
    2306               "unknown box type %4.4s (uncompletetly loaded)", 
    2307               (char*)&p_box->i_type ); 
     2321    if MP4_BOX_TYPE_ASCII() 
     2322        msg_Warn( p_stream, 
     2323                "unknown box type %4.4s (uncompletetly loaded)", 
     2324                (char*)&p_box->i_type ); 
     2325    else 
     2326        msg_Warn( p_stream, 
     2327                "unknown box type c%3.3s (uncompletetly loaded)", 
     2328                (char*)&p_box->i_type+1 ); 
    23082329 
    23092330    return 1; 
     
    25872608        { 
    25882609            /* Should not happen */ 
    2589             msg_Warn( s, 
    2590                       "cannot free box %4.4s, type unknown", 
    2591                       (char*)&p_box->i_type ); 
     2610            if MP4_BOX_TYPE_ASCII() 
     2611                msg_Warn( s, 
     2612                        "cannot free box %4.4s, type unknown", 
     2613                        (char*)&p_box->i_type ); 
     2614            else 
     2615                msg_Warn( s, 
     2616                        "cannot free box c%3.3s, type unknown", 
     2617                        (char*)&p_box->i_type+1 ); 
    25922618        } 
    25932619        else 
     
    26712697    if( !i_level ) 
    26722698    { 
    2673         msg_Dbg( s, "dumping root Box \"%4.4s\"", 
    2674                           (char*)&p_box->i_type ); 
     2699        if MP4_BOX_TYPE_ASCII() 
     2700            msg_Dbg( s, "dumping root Box \"%4.4s\"", 
     2701                              (char*)&p_box->i_type ); 
     2702        else 
     2703            msg_Dbg( s, "dumping root Box \"c%3.3s\"", 
     2704                              (char*)&p_box->i_type+1 ); 
    26752705    } 
    26762706    else 
     
    26832713            str[i*5] = '|'; 
    26842714        } 
    2685         sprintf( str + i_level * 5, "+ %4.4s size %d", 
    2686                       (char*)&p_box->i_type, 
    2687                       (uint32_t)p_box->i_size ); 
    2688  
     2715        if MP4_BOX_TYPE_ASCII() 
     2716            sprintf( str + i_level * 5, "+ %4.4s size %d", 
     2717                        (char*)&p_box->i_type, (uint32_t)p_box->i_size ); 
     2718        else 
     2719            sprintf( str + i_level * 5, "+ c%3.3s size %d", 
     2720                        (char*)&p_box->i_type+1, (uint32_t)p_box->i_size ); 
    26892721        msg_Dbg( s, "%s", str ); 
    26902722    }