Mercurial > mplayer.hg
comparison libmpdemux/demux_mov.c @ 13333:5d4910f6aa79
AVC support moved to libavcodec, avcC atom is now passed in extradata
author | rtognimp |
---|---|
date | Mon, 13 Sep 2004 21:21:48 +0000 |
parents | 8be7dbcea0be |
children | 7dfda76015c8 |
comparison
equal
deleted
inserted
replaced
13332:dcd97985f157 | 13333:5d4910f6aa79 |
---|---|
1115 // AVC decoder configuration record | 1115 // AVC decoder configuration record |
1116 mp_msg(MSGT_DEMUX, MSGL_INFO, "MOV: AVC decoder configuration record atom (%d)!\n", atom_len); | 1116 mp_msg(MSGT_DEMUX, MSGL_INFO, "MOV: AVC decoder configuration record atom (%d)!\n", atom_len); |
1117 if(atom_len > 8) { | 1117 if(atom_len > 8) { |
1118 int i, poffs, cnt; | 1118 int i, poffs, cnt; |
1119 // Parse some parts of avcC, just for fun :) | 1119 // Parse some parts of avcC, just for fun :) |
1120 // avcC formatting happens in vd_ffmpeg, sps and pps are decoded in lavc | 1120 // real parsing is done by avc1 decoder |
1121 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC version: %d\n", *(trak->stdata+pos+8)); | 1121 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC version: %d\n", *(trak->stdata+pos+8)); |
1122 if (*(trak->stdata+pos+8) != 1) | 1122 if (*(trak->stdata+pos+8) != 1) |
1123 mp_msg(MSGT_DEMUX, MSGL_ERR, "MOV: unknown avcC version (%d). Expexct problems.\n", *(trak->stdata+pos+9)); | 1123 mp_msg(MSGT_DEMUX, MSGL_ERR, "MOV: unknown avcC version (%d). Expexct problems.\n", *(trak->stdata+pos+9)); |
1124 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC profile: %d\n", *(trak->stdata+pos+9)); | 1124 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC profile: %d\n", *(trak->stdata+pos+9)); |
1125 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC profile compatibility: %d\n", *(trak->stdata+pos+10)); | 1125 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC profile compatibility: %d\n", *(trak->stdata+pos+10)); |
1126 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC level: %d\n", *(trak->stdata+pos+11)); | 1126 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC level: %d\n", *(trak->stdata+pos+11)); |
1127 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC nal length size: %d\n", (*(trak->stdata+pos+12))&0x03+1); | 1127 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC nal length size: %d\n", ((*(trak->stdata+pos+12))&0x03)+1); |
1128 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC number of sequence param sets: %d\n", cnt = (*(trak->stdata+pos+13) & 0x1f)); | 1128 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC number of sequence param sets: %d\n", cnt = (*(trak->stdata+pos+13) & 0x1f)); |
1129 poffs = pos + 14; | 1129 poffs = pos + 14; |
1130 for (i = 0; i < cnt; i++) { | 1130 for (i = 0; i < cnt; i++) { |
1131 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC sps %d have length %d\n", i, BE_16(trak->stdata+poffs)); | 1131 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC sps %d have length %d\n", i, BE_16(trak->stdata+poffs)); |
1132 poffs += BE_16(trak->stdata+poffs) + 2; | 1132 poffs += BE_16(trak->stdata+poffs) + 2; |
1136 for (i = 0; i < cnt; i++) { | 1136 for (i = 0; i < cnt; i++) { |
1137 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC pps %d have length %d\n", i, BE_16(trak->stdata+poffs)); | 1137 mp_msg(MSGT_DEMUX, MSGL_V, "MOV: avcC pps %d have length %d\n", i, BE_16(trak->stdata+poffs)); |
1138 poffs += BE_16(trak->stdata+poffs) + 2; | 1138 poffs += BE_16(trak->stdata+poffs) + 2; |
1139 } | 1139 } |
1140 // Copy avcC for the AVC decoder | 1140 // Copy avcC for the AVC decoder |
1141 // This data will be sent to decoder with first frame, before frame data | 1141 // This data will be put in extradata below, where BITMAPINFOHEADER is created |
1142 trak->stream_header_len = atom_len-8; | 1142 trak->stream_header_len = atom_len-8; |
1143 trak->stream_header = (unsigned char *)malloc(trak->stream_header_len); | 1143 trak->stream_header = (unsigned char *)malloc(trak->stream_header_len); |
1144 memcpy(trak->stream_header, trak->stdata+pos+8, trak->stream_header_len); | 1144 memcpy(trak->stream_header, trak->stdata+pos+8, trak->stream_header_len); |
1145 } | 1145 } |
1146 break; | 1146 break; |
1267 } | 1267 } |
1268 } | 1268 } |
1269 } | 1269 } |
1270 else | 1270 else |
1271 { | 1271 { |
1272 if (trak->fourcc == mmioFOURCC('a','v','c','1')) { | |
1273 sh->bih=malloc(sizeof(BITMAPINFOHEADER) + trak->stream_header_len); | |
1274 memset(sh->bih,0,sizeof(BITMAPINFOHEADER) + trak->stream_header_len); | |
1275 sh->bih->biSize=40 + trak->stream_header_len; | |
1276 memcpy(((unsigned char *)sh->bih)+40, trak->stream_header, trak->stream_header_len); | |
1277 free (trak->stream_header); | |
1278 trak->stream_header_len = 0; | |
1279 trak->stream_header = NULL; | |
1280 } else { | |
1272 sh->bih=malloc(sizeof(BITMAPINFOHEADER)); | 1281 sh->bih=malloc(sizeof(BITMAPINFOHEADER)); |
1273 memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); | 1282 memset(sh->bih,0,sizeof(BITMAPINFOHEADER)); |
1274 sh->bih->biSize=40; | 1283 sh->bih->biSize=40; |
1284 } | |
1275 } | 1285 } |
1276 sh->bih->biWidth=sh->disp_w; | 1286 sh->bih->biWidth=sh->disp_w; |
1277 sh->bih->biHeight=sh->disp_h; | 1287 sh->bih->biHeight=sh->disp_h; |
1278 sh->bih->biPlanes=0; | 1288 sh->bih->biPlanes=0; |
1279 sh->bih->biBitCount=depth; | 1289 sh->bih->biBitCount=depth; |