aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar rtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 22:40:35 +0000
committerGravatar rtogni <rtogni@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-14 22:40:35 +0000
commit88990e297ce30f151bc76b8d06981c5cd17aee97 (patch)
treed55dad0b28e9dd1e4dac3ae981fe7a976b782464 /libmpdemux
parent4254e10d2a8f1388010dd727e651948823dac634 (diff)
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')
-rw-r--r--libmpdemux/demux_mkv.c20
-rw-r--r--libmpdemux/demux_real.c58
2 files changed, 17 insertions, 61 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index a72387253b..acbba13ce3 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -1869,12 +1869,14 @@ demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid)
unsigned char *dst, *src;
real_video_props_t *rvp;
uint32_t type2;
+ unsigned int cnt;
rvp = (real_video_props_t *) track->private_data;
src = (unsigned char *) (rvp + 1);
- bih = realloc(bih, sizeof (BITMAPINFOHEADER)+12);
- bih->biSize = 48;
+ cnt = track->private_size - sizeof (real_video_props_t);
+ bih = realloc(bih, sizeof (BITMAPINFOHEADER)+8+cnt);
+ bih->biSize = 48+cnt;
bih->biPlanes = 1;
type2 = be2me_32 (rvp->type2);
if (type2 == 0x10003000 || type2 == 0x10003001)
@@ -1882,17 +1884,9 @@ demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid)
else
bih->biCompression=mmioFOURCC('R','V',track->codec_id[9],'0');
dst = (unsigned char *) (bih + 1);
- ((unsigned int *) dst)[0] = be2me_32 (rvp->type1);
- ((unsigned int *) dst)[1] = type2;
-
- if (bih->biCompression <= 0x30335652 && type2 >= 0x20200002)
- {
- /* read secondary WxH for the cmsg24[] (see vd_realvid.c) */
- ((unsigned short *)(bih+1))[4] = 4 * (unsigned short) src[0];
- ((unsigned short *)(bih+1))[5] = 4 * (unsigned short) src[1];
- }
- else
- memset(&dst[8], 0, 4);
+ ((unsigned int *) dst)[0] = rvp->type1;
+ ((unsigned int *) dst)[1] = rvp->type2;
+ stream_read(demuxer->stream, dst+8, cnt);
track->realmedia = 1;
#ifdef USE_QTX_CODECS
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) ||