mirror of
https://github.com/mpv-player/mpv
synced 2025-01-13 00:06:25 +01:00
Get rid of min/max macros from aviheader.h, they do not belong here.
Replace their uses by FFMIN/FFMAX git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21547 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
134a537a76
commit
6caf5586ee
@ -96,7 +96,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
|
||||
if(start + len > sh->a_in_buffer_len)
|
||||
{
|
||||
int l;
|
||||
l = min(sh->a_in_buffer_size - sh->a_in_buffer_len, start + len);
|
||||
l = FFMIN(sh->a_in_buffer_size - sh->a_in_buffer_len, start + len);
|
||||
l = demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len], l);
|
||||
if(! l)
|
||||
break;
|
||||
|
@ -36,7 +36,7 @@ static int bind_pcm(audio_encoder_t *encoder, muxer_stream_t *mux_a)
|
||||
|
||||
static int encode_pcm(audio_encoder_t *encoder, uint8_t *dest, void *src, int nsamples, int max_size)
|
||||
{
|
||||
max_size = min(nsamples, max_size);
|
||||
max_size = FFMIN(nsamples, max_size);
|
||||
memcpy(dest, src, max_size);
|
||||
return max_size;
|
||||
}
|
||||
|
@ -392,11 +392,11 @@ static int init(sh_video_t *sh){
|
||||
if (sh->bih->biSize-sizeof(BITMAPINFOHEADER))
|
||||
/* Palette size in biSize */
|
||||
memcpy(avctx->palctrl->palette, sh->bih+1,
|
||||
min(sh->bih->biSize-sizeof(BITMAPINFOHEADER), AVPALETTE_SIZE));
|
||||
FFMIN(sh->bih->biSize-sizeof(BITMAPINFOHEADER), AVPALETTE_SIZE));
|
||||
else
|
||||
/* Palette size in biClrUsed */
|
||||
memcpy(avctx->palctrl->palette, sh->bih+1,
|
||||
min(sh->bih->biClrUsed * 4, AVPALETTE_SIZE));
|
||||
FFMIN(sh->bih->biClrUsed * 4, AVPALETTE_SIZE));
|
||||
}
|
||||
|
||||
if(sh->bih)
|
||||
|
@ -124,7 +124,7 @@ void x264enc_set_param(m_option_t* opt, char* arg)
|
||||
if(turbo == 1)
|
||||
{
|
||||
param.i_frame_reference = ( param.i_frame_reference + 1 ) >> 1;
|
||||
param.analyse.i_subpel_refine = max( min( 3, param.analyse.i_subpel_refine - 1 ), 1 );
|
||||
param.analyse.i_subpel_refine = FFMAX( FFMIN( 3, param.analyse.i_subpel_refine - 1 ), 1 );
|
||||
param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 );
|
||||
param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
|
||||
param.analyse.i_trellis = 0;
|
||||
|
@ -5,18 +5,6 @@
|
||||
#include "libavutil/common.h"
|
||||
#include "mpbswap.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef mmioFOURCC
|
||||
#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
|
||||
( (uint32_t)(uint8_t)(ch0) | ( (uint32_t)(uint8_t)(ch1) << 8 ) | \
|
||||
|
@ -57,7 +57,7 @@ static int parse_psm(demuxer_t *demux, int len) {
|
||||
prog_len = stream_read_word(demux->stream); //length of program descriptors
|
||||
stream_skip(demux->stream, prog_len); //.. that we ignore
|
||||
es_map_len = stream_read_word(demux->stream); //length of elementary streams map
|
||||
es_map_len = min(es_map_len, len - prog_len - 8); //sanity check
|
||||
es_map_len = FFMIN(es_map_len, len - prog_len - 8); //sanity check
|
||||
while(es_map_len > 0) {
|
||||
type = stream_read_char(demux->stream);
|
||||
id = stream_read_char(demux->stream);
|
||||
@ -91,7 +91,7 @@ static int parse_psm(demuxer_t *demux, int len) {
|
||||
mp_dbg(MSGT_DEMUX,MSGL_V, "PSM ES, id=0x%x, type=%x, stype: %x\n", id, type, priv->es_map[idoffset]);
|
||||
}
|
||||
plen = stream_read_word(demux->stream); //length of elementary stream descriptors
|
||||
plen = min(plen, es_map_len); //sanity check
|
||||
plen = FFMIN(plen, es_map_len); //sanity check
|
||||
stream_skip(demux->stream, plen); //skip descriptors for now
|
||||
es_map_len -= 4 + plen;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ void demux_ogg_scan_stream(demuxer_t* demuxer) {
|
||||
stream_seek(s,demuxer->movi_start);
|
||||
} else {
|
||||
//the 270000 are just a wild guess
|
||||
stream_seek(s,max(ogg_d->pos,demuxer->movi_end-270000));
|
||||
stream_seek(s,FFMAX(ogg_d->pos,demuxer->movi_end-270000));
|
||||
}
|
||||
ogg_sync_reset(sync);
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ static int mp4_parse_sl_packet(pmt_t *pmt, uint8_t *buf, uint16_t packet_len, in
|
||||
|
||||
while(i < sl->ts_len)
|
||||
{
|
||||
m = min(8, sl->ts_len - i);
|
||||
m = FFMIN(8, sl->ts_len - i);
|
||||
v |= getbits(buf, n, m);
|
||||
if(sl->ts_len - i > 8)
|
||||
v <<= 8;
|
||||
@ -1193,7 +1193,7 @@ static int mp4_parse_sl_packet(pmt_t *pmt, uint8_t *buf, uint16_t packet_len, in
|
||||
pl_size = 0;
|
||||
while(i < sl->au_len)
|
||||
{
|
||||
m = min(8, sl->au_len - i);
|
||||
m = FFMIN(8, sl->au_len - i);
|
||||
pl_size |= getbits(buf, n, m);
|
||||
if(sl->au_len - i > 8)
|
||||
pl_size <<= 8;
|
||||
@ -1662,7 +1662,7 @@ static uint16_t get_mp4_desc_len(uint8_t *buf, int *len)
|
||||
int i = 0, j, size = 0;
|
||||
|
||||
mp_msg(MSGT_DEMUX, MSGL_DBG2, "PARSE_MP4_DESC_LEN(%d), bytes: ", *len);
|
||||
j = min(*len, 4);
|
||||
j = FFMIN(*len, 4);
|
||||
while(i < j)
|
||||
{
|
||||
mp_msg(MSGT_DEMUX, MSGL_DBG2, " %x ", buf[i]);
|
||||
@ -2957,7 +2957,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet,
|
||||
|
||||
if(tss->payload_size > 0)
|
||||
{
|
||||
sz = min(tss->payload_size, buf_size);
|
||||
sz = FFMIN(tss->payload_size, buf_size);
|
||||
tss->payload_size -= sz;
|
||||
es->size = sz;
|
||||
}
|
||||
|
@ -98,31 +98,31 @@ static demuxer_t* demux_open_vqf(demuxer_t* demuxer) {
|
||||
memcpy(sdata,&buf[i],slen); sdata[slen]=0; i+=slen;
|
||||
if(sid==mmioFOURCC('N','A','M','E'))
|
||||
{
|
||||
memcpy(hi->Name,sdata,min(BUFSIZ,slen));
|
||||
memcpy(hi->Name,sdata,FFMIN(BUFSIZ,slen));
|
||||
demux_info_add(demuxer,"Title",sdata);
|
||||
}
|
||||
else
|
||||
if(sid==mmioFOURCC('A','U','T','H'))
|
||||
{
|
||||
memcpy(hi->Auth,sdata,min(BUFSIZ,slen));
|
||||
memcpy(hi->Auth,sdata,FFMIN(BUFSIZ,slen));
|
||||
demux_info_add(demuxer,"Author",sdata);
|
||||
}
|
||||
else
|
||||
if(sid==mmioFOURCC('C','O','M','T'))
|
||||
{
|
||||
memcpy(hi->Comt,sdata,min(BUFSIZ,slen));
|
||||
memcpy(hi->Comt,sdata,FFMIN(BUFSIZ,slen));
|
||||
demux_info_add(demuxer,"Comment",sdata);
|
||||
}
|
||||
else
|
||||
if(sid==mmioFOURCC('(','c',')',' '))
|
||||
{
|
||||
memcpy(hi->Cpyr,sdata,min(BUFSIZ,slen));
|
||||
memcpy(hi->Cpyr,sdata,FFMIN(BUFSIZ,slen));
|
||||
demux_info_add(demuxer,"Copyright",sdata);
|
||||
}
|
||||
else
|
||||
if(sid==mmioFOURCC('F','I','L','E'))
|
||||
{
|
||||
memcpy(hi->File,sdata,min(BUFSIZ,slen));
|
||||
memcpy(hi->File,sdata,FFMIN(BUFSIZ,slen));
|
||||
}
|
||||
else
|
||||
if(sid==mmioFOURCC('A','L','B','M')) demux_info_add(demuxer,"Album",sdata);
|
||||
|
@ -936,7 +936,7 @@ static int calc_packet_len(muxer_stream_t *s, int psize, int finalize)
|
||||
{
|
||||
if(!frpos && len>0 && s->type == MUXER_TYPE_VIDEO && spriv->framebuf[n].type==I_FRAME)
|
||||
return len;
|
||||
m = min(spriv->framebuf[n].size - frpos, psize - len);
|
||||
m = FFMIN(spriv->framebuf[n].size - frpos, psize - len);
|
||||
len += m;
|
||||
frpos += m;
|
||||
if(frpos == spriv->framebuf[n].size)
|
||||
@ -997,8 +997,8 @@ static int find_packet_timestamps(muxer_priv_t *priv, muxer_stream_t *s, unsigne
|
||||
|
||||
if(i > -1)
|
||||
{
|
||||
dpts = max(spriv->last_saved_pts, spriv->framebuf[i].pts) -
|
||||
min(spriv->last_saved_pts, spriv->framebuf[i].pts) +
|
||||
dpts = FFMAX(spriv->last_saved_pts, spriv->framebuf[i].pts) -
|
||||
FFMIN(spriv->last_saved_pts, spriv->framebuf[i].pts) +
|
||||
spriv->framebuf[0].idur;
|
||||
|
||||
if(s->type != MUXER_TYPE_VIDEO)
|
||||
@ -1218,7 +1218,7 @@ static int fill_packet(muxer_t *muxer, muxer_stream_t *s, int finalize)
|
||||
update_demux_bufsize(spriv, frm->dts, frm->size, s->type);
|
||||
}
|
||||
|
||||
m = min(frm->size - frm->pos, priv->packet_size - spriv->pack_offset);
|
||||
m = FFMIN(frm->size - frm->pos, priv->packet_size - spriv->pack_offset);
|
||||
memcpy(&(spriv->pack[spriv->pack_offset]), &(frm->buffer[frm->pos]), m);
|
||||
|
||||
len += m;
|
||||
@ -2215,7 +2215,7 @@ static void fix_parameters(muxer_stream_t *stream)
|
||||
{
|
||||
stream->ckid = be2me_32 (0x1bd);
|
||||
if(priv->is_genmpeg1 || priv->is_genmpeg2)
|
||||
fix_audio_sys_header(priv, spriv->id, 0xbd, max(conf_abuf_size, 58)*1024); //only one audio at the moment
|
||||
fix_audio_sys_header(priv, spriv->id, 0xbd, FFMAX(conf_abuf_size, 58)*1024); //only one audio at the moment
|
||||
spriv->id = 0xbd;
|
||||
if(!conf_abuf_size)
|
||||
spriv->max_buffer_size = 16*1024;
|
||||
|
Loading…
Reference in New Issue
Block a user