[MPlayer-dev-eng] Re: mplayer UDP port number

Marc Hoffman mmh at pleasantst.com
Sat Mar 6 20:32:17 CET 2004


You know I was not aware of this let me look at these. I have been  
using this method for a few years now.  I guess I will just look at  
dumpvideo and this rawvideo demux format before I proceed.

doesn't dumpvideo dump the demuxed bitstream?

still looking at both of these other suggestions.

On Mar 6, 2004, at 12:31 PM, John Earl wrote:

> Marc Hoffman wrote:
> >
> > Ok what I have done is added a new video out driver for raw video  
> dumping.
> >
> > static vo_info_t info =
> > {
> >     "RAW file eyuv I420",
> >     "raw",
> >     "mmh",
> >     ""
> > };
> >
> > This has been done in much the same way that pgm files are dumped.
> >
> > and to use it lets say you type
> >
> > mplayer tennis.bits -vo raw
> >
> > Do I just add this file, I don't think I have CVS ACCESS for 1 and
> > secondly who reviews changes?
>
> Doesn't my raw video mux patch from 2 weeks ago (attached, relevant  
> email included below) do what you want, if taken together with the  
> ve_raw patch already committed a month ago? How is your method  
> materially different -- ie, why do you need to be doing this with  
> mplayer when you could equally well use the facilities in mencoder?
>
> John
>
>
> -------- Original Message --------
> Subject: Re: [MPlayer-dev-eng] Re: Why is the  
> mplayer-1.0pre3-dumpvideo.diff patch not applied?
> Date: Mon, 23 Feb 2004 23:28:28 +0000
> From: John Earl <jwe21 at cam.ac.uk>
> To: mplayer-dev-eng at mplayerhq.hu
> References: <20040208223620.0A82D2F9C5 at mail.mplayerhq.hu>  
> <403A081E.6060804 at cam.ac.uk>	 
> <20040223221551.07f5e7b5.attila at kinali.ch>  
> <403A718E.8020808 at cam.ac.uk>  
> <20040223222328.GA17336 at melchior.yamamaya.is-a-geek.org>
>
> Revised patch attached - any other comments?
>
> Tobias Diedrich wrote:
>> John Earl wrote:
>>> Sorry, didn't think the patch would be wanted! There was already an  
>>> online help string (using -of help) but have added a couple lines to  
>>> the man page in new version, attached.
>> I think rawvideo would be a better name. :-)
>> And I think I'm probably not the only one who will find this patch
>> useful, especially for mpeg encoding scripts.
>
> I agree. Done.
>
> Have you actually tried it to make sure it does what you expect with
> compressed streams? (I'm only using it with -of rawvideo -ovc raw)
>
>>> +static void write_raw_chunk(FILE *f,int len,void* data){
>>> +    if(len>0){
>>> +	if(data){
>>> +	    // DATA
>>> +	    fwrite(data,len,1,f);
>>> +	} else {
>>> +	    // JUNK
>>> +	    char *avi_junk_data="[= MPlayer junk data! =]";
>>> +	    if(len&1) ++len; // padding
>>> +	    while(len>0){
>>> +		int l=strlen(avi_junk_data);
>>> +		if(l>len) l=len;
>>> +		fwrite(avi_junk_data,l,1,f);
>>> +		len-=l;
>>> +	    }
>>> +	}
>>> +    }
>>> +}
>> You can drop the junk path.
>
> The attached patch loses the junk path as suggested.
>
>>> +    if((unsigned int)len>s->h.dwSuggestedBufferSize)  
>>> s->h.dwSuggestedBufferSize=len;
>> This line should be unneeded too.
>
> Ok, done. I wasn't careful enough to work out where else
> dwSuggestedBufferSize might be used.
>
> J
>
> ? libmpdemux/muxer_rawvideo.c
> Index: cfg-mencoder.h
> ===================================================================
> RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
> retrieving revision 1.78
> diff -u -r1.78 cfg-mencoder.h
> --- cfg-mencoder.h	17 Feb 2004 12:43:06 -0000	1.78
> +++ cfg-mencoder.h	23 Feb 2004 23:12:44 -0000
> @@ -151,9 +151,11 @@
>  m_option_t of_conf[]={
>  	{"avi", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_AVI,  
> NULL},
>  	{"mpeg", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_MPEG,  
> NULL},
> +	{"rawvideo", &out_file_format, CONF_TYPE_FLAG, 0, 0,  
> MUXER_TYPE_RAWVIDEO, NULL},
>  	{"help", "\nAvailable output formats:\n"
>  	"   avi      - Microsoft Audio/Video Interleaved\n"
>  	"   mpeg     - MPEG-1 system stream format\n"
> +	"   rawvideo - (video only, one stream only) raw stream, no muxing\n"
>  	"\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
>  	{NULL, NULL, 0, 0, 0, 0, NULL}
>  };
> Index: mencoder.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/mencoder.c,v
> retrieving revision 1.235
> diff -u -r1.235 mencoder.c
> --- mencoder.c	18 Feb 2004 13:33:16 -0000	1.235
> +++ mencoder.c	23 Feb 2004 23:12:45 -0000
> @@ -527,6 +527,10 @@
>      mp_msg(MSGT_MENCODER,MSGL_INFO,"input fps will be interpreted as  
> %5.2f instead\n", sh_video->fps);
>    }
>
> +  if(sh_audio && out_file_format==MUXER_TYPE_RAWVIDEO){
> +      mp_msg(MSGT_MENCODER,MSGL_ERR,"Output file format RAWVIDEO does  
> not support audio - disabling audio\n");
> +      sh_audio=NULL;
> +  }
>    if(sh_audio && out_audio_codec<0){
>      if(audio_id==-2)
>  	mp_msg(MSGT_MENCODER,MSGL_ERR,"This demuxer doesn't support -nosound  
> yet.\n");
> Index: DOCS/man/en/mplayer.1
> ===================================================================
> RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
> retrieving revision 1.550
> diff -u -r1.550 mplayer.1
> --- DOCS/man/en/mplayer.1	23 Feb 2004 21:12:06 -0000	1.550
> +++ DOCS/man/en/mplayer.1	23 Feb 2004 23:12:45 -0000
> @@ -3827,6 +3827,8 @@
>  encode to avi (default)
>  .IPs "\-of mpeg"
>  encode to mpeg
> +.IPs "\-of rawvideo"
> +raw video stream (no muxing - video only, one stream only)
>  .RE
>  .PD 1
>  .
> Index: libmpdemux/Makefile
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
> retrieving revision 1.75
> diff -u -r1.75 Makefile
> --- libmpdemux/Makefile	23 Jan 2004 21:34:28 -0000	1.75
> +++ libmpdemux/Makefile	23 Feb 2004 23:12:45 -0000
> @@ -3,7 +3,7 @@
>
>  include ../config.mak
>
> -SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c  
> aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c  
> demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c  
> demux_pva.c demux_viv.c demuxer.c dvdnav_stream.c open.c parse_es.c  
> stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c  
> stream_ftp.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c  
> frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c  
> yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c  
> demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c  
> demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c  
> ai_alsa.c ai_alsa1x.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c  
> cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c
> +SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c  
> aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c  
> demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c  
> demux_pva.c demux_viv.c demuxer.c dvdnav_stream.c open.c parse_es.c  
> stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c  
> stream_ftp.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c  
> frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c  
> yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c  
> demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c  
> demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c  
> ai_alsa.c ai_alsa1x.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c  
> cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c  
> muxer_rawvideo.c
>  ifeq ($(XMMS_PLUGINS),yes)
>  SRCS += demux_xmms.c
>  endif
> Index: libmpdemux/muxer.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.c,v
> retrieving revision 1.3
> diff -u -r1.3 muxer.c
> --- libmpdemux/muxer.c	19 Jan 2003 00:33:11 -0000	1.3
> +++ libmpdemux/muxer.c	23 Feb 2004 23:12:45 -0000
> @@ -22,6 +22,9 @@
>        case MUXER_TYPE_MPEG:
>  	muxer_init_muxer_mpeg(muxer);
>  	break;
> +      case MUXER_TYPE_RAWVIDEO:
> +        muxer_init_muxer_rawvideo(muxer);
> +	break;
>        case MUXER_TYPE_AVI:
>        default:
>  	muxer_init_muxer_avi(muxer);
> Index: libmpdemux/muxer.h
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.h,v
> retrieving revision 1.8
> diff -u -r1.8 muxer.h
> --- libmpdemux/muxer.h	22 Oct 2003 17:04:39 -0000	1.8
> +++ libmpdemux/muxer.h	23 Feb 2004 23:12:45 -0000
> @@ -6,6 +6,7 @@
>
>  #define MUXER_TYPE_AVI 0
>  #define MUXER_TYPE_MPEG 1
> +#define MUXER_TYPE_RAWVIDEO 2
>
>  #define MUXER_MPEG_BLOCKSIZE 2048	// 2048 or 2324 - ?
>
> @@ -75,4 +76,4 @@
>
>  void muxer_init_muxer_avi(muxer_t *);
>  void muxer_init_muxer_mpeg(muxer_t *);
> -
> +void muxer_init_muxer_rawvideo(muxer_t *);
>
> --- /dev/null	1970-01-01 01:00:00.000000000 +0100
> +++ libmpdemux/muxer_rawvideo.c	2004-02-23 23:11:47.543374952 +0000
> @@ -0,0 +1,99 @@
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <inttypes.h>
> +#include <unistd.h>
> +
> +#include "config.h"
> +#include "../version.h"
> +
> +//#include "stream.h"
> +//#include "demuxer.h"
> +//#include "stheader.h"
> +
> +#include "wine/mmreg.h"
> +#include "wine/avifmt.h"
> +#include "wine/vfw.h"
> +#include "bswap.h"
> +
> +#include "muxer.h"
> +
> +static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int  
> type){
> +    muxer_stream_t* s;
> +    if (!muxer) return NULL;
> +    if (type == MUXER_TYPE_AUDIO) {
> +	printf("Rawvideo muxer does not support audio !\n");
> +	return NULL;
> +    }
> +    if(muxer->avih.dwStreams>=1){
> +	printf("Too many streams! Rawvideo muxer supports only one video  
> stream !\n");
> +	return NULL;
> +    }
> +    s=malloc(sizeof(muxer_stream_t));
> +    memset(s,0,sizeof(muxer_stream_t));
> +    if(!s) return NULL; // no mem!?
> +    muxer->streams[muxer->avih.dwStreams]=s;
> +    s->type=type;
> +    s->id=muxer->avih.dwStreams;
> +    s->timer=0.0;
> +    s->size=0;
> +    s->muxer=muxer;
> +    switch(type){
> +    case MUXER_TYPE_VIDEO:
> +      s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
> +      s->h.fccType=streamtypeVIDEO;
> +      if(!muxer->def_v) muxer->def_v=s;
> +      break;
> +    default:
> +      printf("WarninG! unknown stream type: %d\n",type);
> +      return NULL;
> +    }
> +    muxer->avih.dwStreams++;
> +    return s;
> +}
> +
> +static void write_rawvideo_chunk(FILE *f,int len,void* data){
> +    if(len>0){
> +	if(data){
> +	    // DATA
> +	    fwrite(data,len,1,f);
> +	}
> +    }
> +}
> +
> +static void rawvideofile_write_chunk(muxer_stream_t *s,size_t  
> len,unsigned int flags){
> +    muxer_t *muxer=s->muxer;
> +
> +    // write out the chunk:
> +    write_rawvideo_chunk(muxer->file,len,s->buffer); /* unsigned char  
> */
> +
> +    // alter counters:
> +    if(s->h.dwSampleSize){
> +	// CBR
> +	s->h.dwLength+=len/s->h.dwSampleSize;
> +	if(len%s->h.dwSampleSize) printf("Warning! len isn't divisable by  
> samplesize!\n");
> +    } else {
> +	// VBR
> +	s->h.dwLength++;
> +    }
> +    s->timer=(double)s->h.dwLength*s->h.dwScale/s->h.dwRate;
> +    s->size+=len;
> +    // if((unsigned int)len>s->h.dwSuggestedBufferSize)  
> s->h.dwSuggestedBufferSize=len;
> +
> +}
> +
> +static void rawvideofile_write_header(muxer_t *muxer){
> +    return;
> +}
> +
> +static void rawvideofile_write_index(muxer_t *muxer){
> +    return;
> +}
> +
> +void muxer_init_muxer_rawvideo(muxer_t *muxer){
> +  muxer->cont_new_stream = &rawvideofile_new_stream;
> +  muxer->cont_write_chunk = &rawvideofile_write_chunk;
> +  muxer->cont_write_header = &rawvideofile_write_header;
> +  muxer->cont_write_index = &rawvideofile_write_index;
> +}
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng




More information about the MPlayer-dev-eng mailing list