summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_real.c
diff options
context:
space:
mode:
authorrtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 22:40:35 +0000
committerrtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 22:40:35 +0000
commit88990e297ce30f151bc76b8d06981c5cd17aee97 (patch)
treed55dad0b28e9dd1e4dac3ae981fe7a976b782464 /libmpdemux/demux_real.c
parent4254e10d2a8f1388010dd727e651948823dac634 (diff)
downloadmpv-88990e297ce30f151bc76b8d06981c5cd17aee97.tar.bz2
mpv-88990e297ce30f151bc76b8d06981c5cd17aee97.tar.xz
Fix extradata passing to lavc RV20 decoder
Pass video codec extradata unchanged from demux_real, sync vd_realvid to the new format Sync mkv demuxer to the changes above (cmsg24 extradata was totally broken before) Detect cmsg24 size from extradata (was fixed) Based on a patch by elupus >> elupus >a< ecce se << git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20936 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_real.c')
-rw-r--r--libmpdemux/demux_real.c58
1 files changed, 10 insertions, 48 deletions
diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c
index 2c7ddd8a44..64356ef73f 100644
--- a/libmpdemux/demux_real.c
+++ b/libmpdemux/demux_real.c
@@ -1514,9 +1514,9 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
/* emulate BITMAPINFOHEADER */
- sh->bih = malloc(sizeof(BITMAPINFOHEADER)+16);
- memset(sh->bih, 0, sizeof(BITMAPINFOHEADER)+16);
- sh->bih->biSize = 48;
+ sh->bih = malloc(sizeof(BITMAPINFOHEADER));
+ memset(sh->bih, 0, sizeof(BITMAPINFOHEADER));
+ sh->bih->biSize = sizeof(BITMAPINFOHEADER);
sh->disp_w = sh->bih->biWidth = stream_read_word(demuxer->stream);
sh->disp_h = sh->bih->biHeight = stream_read_word(demuxer->stream);
sh->bih->biPlanes = 1;
@@ -1548,57 +1548,19 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
}
stream_skip(demuxer->stream, 2);
- // read codec sub-format (to make difference between low and high rate codec)
- ((unsigned int*)(sh->bih+1))[0]=stream_read_dword(demuxer->stream);
-
- /* h263 hack */
- tmp = stream_read_dword(demuxer->stream);
- ((unsigned int*)(sh->bih+1))[1]=tmp;
- mp_msg(MSGT_DEMUX,MSGL_V,"H.263 ID: %x\n", tmp);
- switch (tmp)
{
- case 0x10000000:
- /* sub id: 0 */
- /* codec id: rv10 */
- break;
- case 0x10003000:
- case 0x10003001:
- /* sub id: 3 */
- /* codec id: rv10 */
- sh->bih->biCompression = sh->format = mmioFOURCC('R', 'V', '1', '3');
- break;
- case 0x20001000:
- case 0x20100001:
- case 0x20200002:
- /* codec id: rv20 */
- break;
- case 0x30202002:
- /* codec id: rv30 */
- break;
- case 0x40000000:
- /* codec id: rv40 */
- break;
- default:
- /* codec id: none */
- mp_msg(MSGT_DEMUX,MSGL_V,"unknown id: %x\n", tmp);
- }
-
- if((sh->format<=0x30335652) && (tmp>=0x20200002)){
- // read data for the cmsg24[] (see vd_realvid.c)
+ // read and store codec extradata
unsigned int cnt = codec_data_size - (stream_tell(demuxer->stream) - codec_pos);
- if (cnt < 2) {
- mp_msg(MSGT_DEMUX, MSGL_ERR,"realvid: cmsg24 data too short (size %u)\n", cnt);
+ if (cnt > 0x7fffffff - sizeof(BITMAPINFOHEADER)) {
+ mp_msg(MSGT_DEMUX, MSGL_ERR,"Extradata too big (%u)\n", cnt);
} else {
- int ii;
- if (cnt > 8) {
- mp_msg(MSGT_DEMUX, MSGL_WARN,"realvid: cmsg24 data too big, please report (size %u)\n", cnt);
- cnt = 8;
- }
- for (ii = 0; ii < cnt; ii++)
- ((unsigned char*)(sh->bih+1))[8+ii]=(unsigned short)stream_read_char(demuxer->stream);
+ sh->bih = realloc(sh->bih, sizeof(BITMAPINFOHEADER) + cnt);
sh->bih->biSize += cnt;
+ stream_read(demuxer->stream, ((unsigned char*)(sh->bih+1)), cnt);
}
}
+ if(sh->format == 0x30315652 && ((unsigned char*)(sh->bih+1))[6] == 0x30)
+ sh->bih->biCompression = sh->format = mmioFOURCC('R', 'V', '1', '3');
/* Select video stream with highest bitrate if multirate file*/
if (priv->is_multirate && ((demuxer->video->id == -1) ||