Mercurial > mplayer.hg
changeset 35314:eaace9a7e822
Simplify: remove useless casts, NULL checks etc.
author | reimar |
---|---|
date | Sat, 10 Nov 2012 14:38:49 +0000 |
parents | 2b211b058ee2 |
children | 56081c772b4a |
files | libmpdemux/muxer_lavf.c libmpdemux/muxer_mpeg.c |
diffstat | 2 files changed, 16 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/muxer_lavf.c Sat Nov 10 14:31:14 2012 +0000 +++ b/libmpdemux/muxer_lavf.c Sat Nov 10 14:38:49 2012 +0000 @@ -115,7 +115,7 @@ muxer_stream_priv_t *spriv; AVCodecContext *ctx; - if(!muxer || (type != MUXER_TYPE_VIDEO && type != MUXER_TYPE_AUDIO)) + if(type != MUXER_TYPE_VIDEO && type != MUXER_TYPE_AUDIO) { mp_msg(MSGT_MUXER, MSGL_ERR, "UNKNOWN TYPE %d\n", type); return NULL; @@ -248,7 +248,7 @@ { muxer_t *muxer = stream->muxer; muxer_priv_t *priv = muxer->priv; - muxer_stream_priv_t *spriv = (muxer_stream_priv_t *) stream->priv; + muxer_stream_priv_t *spriv = stream->priv; AVPacket pkt; if(len)
--- a/libmpdemux/muxer_mpeg.c Sat Nov 10 14:31:14 2012 +0000 +++ b/libmpdemux/muxer_mpeg.c Sat Nov 10 14:38:49 2012 +0000 @@ -363,11 +363,10 @@ static int add_frame(muxer_headers_t *spriv, uint64_t idur, uint8_t *ptr, int len, uint8_t pt, uint64_t dts, uint64_t pts); static muxer_stream_t* mpegfile_new_stream(muxer_t *muxer,int type){ - muxer_priv_t *priv = (muxer_priv_t*) muxer->priv; + muxer_priv_t *priv = muxer->priv; muxer_stream_t *s; muxer_headers_t *spriv; - if (!muxer) return NULL; if(muxer->avih.dwStreams>=MUXER_MAX_STREAMS){ mp_msg(MSGT_MUXER, MSGL_ERR, "Too many streams! increase MUXER_MAX_STREAMS !\n"); return NULL; @@ -573,9 +572,7 @@ static int write_mpeg_pack_header(muxer_t *muxer, char *buff) { int len; - muxer_priv_t *priv; - - priv = (muxer_priv_t *) muxer->priv; + muxer_priv_t *priv = muxer->priv; AV_WB32(buff, PACK_HEADER_START_CODE); if(priv->mux==MUX_MPEG1) { @@ -599,8 +596,7 @@ { int len; uint8_t i; - muxer_priv_t *priv; - priv = (muxer_priv_t *) muxer->priv; + muxer_priv_t *priv = muxer->priv; len = 0; AV_WB32(&buff[len], SYSTEM_HEADER_START_CODE); @@ -638,8 +634,7 @@ uint8_t i; uint16_t dlen; uint32_t crc; - muxer_priv_t *priv; - priv = (muxer_priv_t *) muxer->priv; + muxer_priv_t *priv = muxer->priv; len = 0; AV_WB32(&buff[len], PSM_START_CODE); @@ -842,13 +837,10 @@ static int write_mpeg_pack(muxer_t *muxer, muxer_stream_t *s, stream_t *stream, int isoend) { size_t tot, offset; - muxer_priv_t *priv; - unsigned char *buff; + muxer_priv_t *priv = muxer->priv; + unsigned char *buff = priv->buff; int stuffing_len; - priv = (muxer_priv_t *) muxer->priv; - buff = priv->buff; - if(isoend) { offset = priv->packet_size - 4; @@ -1131,8 +1123,8 @@ //spriv->pack_offset is the start position initialized to 0 //data is taken from spriv->framebuf //if audio and a52 insert the headers - muxer_priv_t *priv = (muxer_priv_t *) muxer->priv; - muxer_headers_t *spriv = (muxer_headers_t *) s->priv; + muxer_priv_t *priv = muxer->priv; + muxer_headers_t *spriv = s->priv; int len, m, n, dvd_pack = 0; int write_psm = 0; mpeg_frame_t *frm; @@ -1495,7 +1487,7 @@ uint64_t init_delay = 0; muxer_stream_t *s, *vs, *as; muxer_headers_t *vpriv = NULL, *apriv = NULL; - muxer_priv_t *priv = (muxer_priv_t *) muxer->priv; + muxer_priv_t *priv = muxer->priv; uint64_t iduration, iaduration; /* @@ -2286,8 +2278,8 @@ size_t sz = 0; uint64_t tmp; muxer_t *muxer = s->muxer; - muxer_priv_t *priv = (muxer_priv_t *)muxer->priv; - muxer_headers_t *spriv = (muxer_headers_t*) s->priv; + muxer_priv_t *priv = muxer->priv; + muxer_headers_t *spriv = s->priv; float fps; uint32_t stream_format, nf; @@ -2388,7 +2380,7 @@ { int i, nf; double fake_timer; - muxer_priv_t *priv = (muxer_priv_t *) muxer->priv; + muxer_priv_t *priv = muxer->priv; mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer); @@ -2410,7 +2402,7 @@ static void mpegfile_write_header(muxer_t *muxer) { - muxer_priv_t *priv = (muxer_priv_t*) muxer->priv; + muxer_priv_t *priv = muxer->priv; mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader); @@ -2722,7 +2714,7 @@ return 0; } - muxer->priv = (void *) priv; + muxer->priv = priv; muxer->cont_new_stream = &mpegfile_new_stream; muxer->cont_write_chunk = &mpegfile_write_chunk; muxer->cont_write_header = &mpegfile_write_header;