comparison dv.c @ 12528:f4caff0e1e10 libavcodec

In dv decoder, set sample aspect aspect ratio, fix issue #1612
author bcoudurier
date Mon, 27 Sep 2010 21:31:29 +0000
parents aaf12cfcfdbf
children
comparison
equal deleted inserted replaced
12527:fae5731a5543 12528:f4caff0e1e10
1079 AVPacket *avpkt) 1079 AVPacket *avpkt)
1080 { 1080 {
1081 const uint8_t *buf = avpkt->data; 1081 const uint8_t *buf = avpkt->data;
1082 int buf_size = avpkt->size; 1082 int buf_size = avpkt->size;
1083 DVVideoContext *s = avctx->priv_data; 1083 DVVideoContext *s = avctx->priv_data;
1084 const uint8_t* vsc_pack;
1085 int apt, is16_9;
1084 1086
1085 s->sys = ff_dv_frame_profile(s->sys, buf, buf_size); 1087 s->sys = ff_dv_frame_profile(s->sys, buf, buf_size);
1086 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) { 1088 if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
1087 av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n"); 1089 av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
1088 return -1; /* NOTE: we only accept several full frames */ 1090 return -1; /* NOTE: we only accept several full frames */
1111 emms_c(); 1113 emms_c();
1112 1114
1113 /* return image */ 1115 /* return image */
1114 *data_size = sizeof(AVFrame); 1116 *data_size = sizeof(AVFrame);
1115 *(AVFrame*)data = s->picture; 1117 *(AVFrame*)data = s->picture;
1118
1119 /* Determine the codec's sample_aspect ratio from the packet */
1120 vsc_pack = buf + 80*5 + 48 + 5;
1121 if ( *vsc_pack == dv_video_control ) {
1122 apt = buf[4] & 0x07;
1123 is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07)));
1124 avctx->sample_aspect_ratio = s->sys->sar[is16_9];
1125 }
1116 1126
1117 return s->sys->frame_size; 1127 return s->sys->frame_size;
1118 } 1128 }
1119 #endif /* CONFIG_DVVIDEO_DECODER */ 1129 #endif /* CONFIG_DVVIDEO_DECODER */
1120 1130