Revision 26783e85
libavformat/asfdec.c | ||
---|---|---|
36 | 36 |
int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID |
37 | 37 |
ASFStream streams[128]; ///< it's max number and it's not that big |
38 | 38 |
uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) |
39 |
AVRational dar[128]; |
|
39 | 40 |
char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) |
40 | 41 |
/* non streamed additonnal info */ |
41 | 42 |
/* packet filling */ |
... | ... | |
192 | 193 |
ASFStream *asf_st; |
193 | 194 |
int size, i; |
194 | 195 |
int64_t gsize; |
195 |
AVRational dar[128]; |
|
196 | 196 |
uint32_t bitrate[128]; |
197 | 197 |
|
198 |
memset(dar, 0, sizeof(dar)); |
|
199 | 198 |
memset(bitrate, 0, sizeof(bitrate)); |
200 | 199 |
|
201 | 200 |
ff_get_guid(pb, &g); |
... | ... | |
477 | 476 |
* Asf stream count start at 1. I am using 0 to the container value since it's unused |
478 | 477 |
*/ |
479 | 478 |
if (!strcmp(name, "AspectRatioX")){ |
480 |
dar[0].num= get_value(s->pb, value_type); |
|
479 |
asf->dar[0].num= get_value(s->pb, value_type);
|
|
481 | 480 |
} else if(!strcmp(name, "AspectRatioY")){ |
482 |
dar[0].den= get_value(s->pb, value_type); |
|
481 |
asf->dar[0].den= get_value(s->pb, value_type);
|
|
483 | 482 |
} else |
484 | 483 |
get_tag(s, name, value_type, value_len); |
485 | 484 |
} |
... | ... | |
503 | 502 |
url_fskip(pb, value_len - 2); |
504 | 503 |
|
505 | 504 |
if(stream_num<128){ |
506 |
if (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num; |
|
507 |
else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num; |
|
505 |
if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num;
|
|
506 |
else if(!strcmp(name, "AspectRatioY")) asf->dar[stream_num].den= value_num;
|
|
508 | 507 |
} |
509 | 508 |
} |
510 | 509 |
} else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { |
... | ... | |
617 | 616 |
AVStream *st = s->streams[stream_num]; |
618 | 617 |
if (!st->codec->bit_rate) |
619 | 618 |
st->codec->bit_rate = bitrate[i]; |
620 |
if (dar[i].num > 0 && dar[i].den > 0){
|
|
619 |
if (asf->dar[i].num > 0 && asf->dar[i].den > 0){
|
|
621 | 620 |
av_reduce(&st->sample_aspect_ratio.num, |
622 | 621 |
&st->sample_aspect_ratio.den, |
623 |
dar[i].num, dar[i].den, INT_MAX);
|
|
624 |
} else if ((dar[0].num > 0) && (dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set.
|
|
622 |
asf->dar[i].num, asf->dar[i].den, INT_MAX);
|
|
623 |
} else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set.
|
|
625 | 624 |
av_reduce(&st->sample_aspect_ratio.num, |
626 | 625 |
&st->sample_aspect_ratio.den, |
627 |
dar[0].num, dar[0].den, INT_MAX);
|
|
626 |
asf->dar[0].num, asf->dar[0].den, INT_MAX);
|
|
628 | 627 |
|
629 | 628 |
//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); |
630 | 629 |
|
Also available in: Unified diff