Mercurial > mplayer.hg
changeset 30928:89bfad4c1711
Support concatenated YUV4MPEG files.
author | reimar |
---|---|
date | Sat, 27 Mar 2010 16:01:22 +0000 |
parents | 9a9d57f6d788 |
children | e97f3f59fb19 |
files | libmpdemux/demux_y4m.c |
diffstat | 1 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_y4m.c Sat Mar 27 15:35:59 2010 +0000 +++ b/libmpdemux/demux_y4m.c Sat Mar 27 16:01:22 2010 +0000 @@ -76,6 +76,7 @@ return DEMUXER_TYPE_Y4M; } +static void read_streaminfo(demuxer_t *demuxer); // return value: // 0 = EOF or no stream found @@ -87,6 +88,14 @@ y4m_frame_info_t fi; unsigned char *buf[3]; int err, size; + int nextc; + + nextc = stream_read_char(demux->stream); + stream_skip(demux->stream, -1); + if (nextc == 'Y') { + read_streaminfo(demux); + demux->seekable = 0; + } y4m_init_frame_info(&fi); @@ -136,15 +145,13 @@ return 1; } -static demuxer_t* demux_open_y4m(demuxer_t* demuxer){ - y4m_priv_t* priv = demuxer->priv; +static void read_streaminfo(demuxer_t *demuxer) +{ + y4m_priv_t *priv = demuxer->priv; + sh_video_t *sh = demuxer->video->sh; y4m_ratio_t ratio; - sh_video_t* sh=new_sh_video(demuxer,0); int err; - priv->framenum = 0; - priv->si = malloc(sizeof(y4m_stream_info_t)); - if (priv->is_older) { char buf[4]; @@ -228,7 +235,6 @@ sh->format = mmioFOURCC('Y', 'V', '1', '2'); - sh->bih=calloc(1, sizeof(BITMAPINFOHEADER)); sh->bih->biSize=40; sh->bih->biWidth = sh->disp_w; sh->bih->biHeight = sh->disp_h; @@ -237,14 +243,25 @@ sh->bih->biCompression=sh->format; sh->bih->biSizeImage=sh->bih->biWidth*sh->bih->biHeight*3/2; /* YV12 */ + mp_msg(MSGT_DEMUX, MSGL_INFO, "YUV4MPEG2 Video stream %d size: display: %dx%d, codec: %ux%u\n", + demuxer->video->id, sh->disp_w, sh->disp_h, sh->bih->biWidth, + sh->bih->biHeight); +} + +static demuxer_t* demux_open_y4m(demuxer_t* demuxer){ + y4m_priv_t* priv = demuxer->priv; + sh_video_t* sh=new_sh_video(demuxer,0); + + priv->framenum = 0; + priv->si = malloc(sizeof(y4m_stream_info_t)); + + sh->bih=calloc(1, sizeof(BITMAPINFOHEADER)); + demuxer->video->sh=sh; sh->ds=demuxer->video; demuxer->video->id=0; - - mp_msg(MSGT_DEMUX, MSGL_INFO, "YUV4MPEG2 Video stream %d size: display: %dx%d, codec: %ux%u\n", - demuxer->video->id, sh->disp_w, sh->disp_h, sh->bih->biWidth, - sh->bih->biHeight); + read_streaminfo(demuxer); return demuxer; }