-#define RM(x) do { i_data -= (x); p_data += (x); } while(0)
- RM(4);
-
- i_type = GetDWBE( p_data ); RM(4);
- i_len = GetDWBE( p_data ); RM(4);
- if( i_len < 0 || i_data < i_len + 4 )
- goto error;
- psz_mime = strndup( (const char*)p_data, i_len ); RM(i_len);
- i_len = GetDWBE( p_data ); RM(4);
- if( i_len < 0 || i_data < i_len + 4*4 + 4)
- goto error;
- psz_description = strndup( (const char*)p_data, i_len ); RM(i_len);
- EnsureUTF8( psz_description );
- RM(4*4);
- i_len = GetDWBE( p_data ); RM(4);
- if( i_len < 0 || i_len > i_data )
- goto error;
-
- msg_Dbg( p_demux, "FLAC: Picture type=%d mime=%s description='%s' file length=%d",
- i_type, psz_mime, psz_description, i_len );
-
- snprintf( psz_name, sizeof(psz_name), "picture%d", p_sys->i_attachments );
- if( !strcasecmp( psz_mime, "image/jpeg" ) )
- strcat( psz_name, ".jpg" );
- else if( !strcasecmp( psz_mime, "image/png" ) )
- strcat( psz_name, ".png" );
-
- p_attachment = vlc_input_attachment_New( psz_name, psz_mime, psz_description,
- p_data, i_data );
- TAB_APPEND( p_sys->i_attachments, p_sys->attachments, p_attachment );