[MPlayer-dev-eng] [PATCH] Support asf aspect ratio

Zuxy Meng zuxy.meng at gmail.com
Wed Dec 13 02:43:16 CET 2006


Hi,

2006/12/13, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Tue, Dec 12, 2006 at 08:30:40PM +0800, Zuxy Meng wrote:
> >  ////////////////////////
> > +// ASF Metadata Record
> > +////////////////////////
> > +typedef struct {
> > +  // must be 0 for metadata record, might be non-zero for metadata lib record
> > +  uint16_t lang_list_index;
> > +  uint16_t stream_num;
> > +  uint16_t name_length;
> > +  uint16_t data_type;
> > +  uint32_t data_length;
> > +  uint16_t* name;
> > +  void* data;
> > +} ASF_meta_record_t;
> > +
>
> Well, could be moved to asfheader.c since it is only used there...
>
> > +// Data types are usually represented by a uint16_t of following values
> > +typedef enum {
> > +     ASF_UCS16LEs_e, // Unicode string encoded as UCS16LE
> > +     ASF_Bytes_e,    // Array of bytes
> > +     ASF_Bool_e,     // BOOL represented by a uint32_t
> > +     ASF_DWORD_e,
> > +     ASF_QWORD_e,
> > +     ASF_WORD_e,
> > +     ASF_GUID_e
> > +} ASF_DataType_e;
>
> Not used at all, can be removed.
>
> > +static int get_meta(char *buf, int buf_len, int this_stream_num,
> > +    float* asp_ratio)
> > +{
> > +  int pos = 0;
> > +  uint16_t records_count, i;
> > +  uint32_t x = 0, y = 0;
> > +
> > +  if ((pos = find_asf_guid(buf, asf_metadata_header, pos, buf_len)) < 0)
> > +    return 0;
> > +
> > +  CHECKDEC(buf_len, pos);
> > +  buf += pos;
> > +  CHECKDEC(buf_len, 2);
> > +  records_count = LE_16(buf);
> > +  buf += 2;
> > +
> > +  for (i = 0; i < records_count; i++) {
> > +    ASF_meta_record_t record_entry;
> > +    uint32_t data;
> > +    uint16_t name_len;
> > +    char* name;
> > +
> > +    if (!(buf = read_meta_record(&record_entry, buf, &buf_len)))
> > +        return 0;
> > +    /* reserved, must be zero */
> > +    if (record_entry.lang_list_index)
> > +      continue;
> > +    /* match stream number: 0 to match all */
> > +    if (record_entry.stream_num && record_entry.stream_num != this_stream_num)
> > +      continue;
> > +    if (!(name = get_ucs2str(record_entry.name, name_len))) {
>
> This should be record_entry.name_length, and the name_len variable
> should go.
> Data is unused, too.

Ahh...absolutely my fault. Should have turned -Wall on:-) Anyway see
if this one is better.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asfheader.c.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20061213/34cb1263/attachment.asc>


More information about the MPlayer-dev-eng mailing list