Commit 2bb6eba2 authored by Aurelien Jacobs's avatar Aurelien Jacobs

remove ff_get_fourcc() and use AV_RL32() instead

Originally committed as revision 16654 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 9ce6c138
......@@ -36,6 +36,7 @@
#include "libavformat/rtsp.h"
#include "libavutil/avstring.h"
#include "libavutil/random.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/opt.h"
#include <stdarg.h>
#include <unistd.h>
......@@ -4187,7 +4188,7 @@ static int parse_ffconfig(const char *filename)
} else if (!strcasecmp(cmd, "VideoTag")) {
get_arg(arg, sizeof(arg), &p);
if ((strlen(arg) == 4) && stream)
video_enc.codec_tag = ff_get_fourcc(arg);
video_enc.codec_tag = AV_RL32(arg);
} else if (!strcasecmp(cmd, "BitExact")) {
if (stream)
video_enc.flags |= CODEC_FLAG_BITEXACT;
......
......@@ -689,7 +689,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4));
}
if(frame_4cc == ff_get_fourcc("cfrm")){
if(frame_4cc == AV_RL32("cfrm")){
int free_index=-1;
const int data_size= buf_size - 20;
const int id= AV_RL32(buf+12);
......@@ -730,7 +730,7 @@ static int decode_frame(AVCodecContext *avctx,
}
cfrm->size= cfrm->id= 0;
frame_4cc= ff_get_fourcc("pfrm");
frame_4cc= AV_RL32("pfrm");
}else
return buf_size;
}else{
......@@ -756,19 +756,19 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
if(frame_4cc == ff_get_fourcc("ifr2")){
if(frame_4cc == AV_RL32("ifr2")){
p->pict_type= FF_I_TYPE;
if(decode_i2_frame(f, buf-4, frame_size) < 0)
return -1;
}else if(frame_4cc == ff_get_fourcc("ifrm")){
}else if(frame_4cc == AV_RL32("ifrm")){
p->pict_type= FF_I_TYPE;
if(decode_i_frame(f, buf, frame_size) < 0)
return -1;
}else if(frame_4cc == ff_get_fourcc("pfrm") || frame_4cc == ff_get_fourcc("pfr2")){
}else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
p->pict_type= FF_P_TYPE;
if(decode_p_frame(f, buf, frame_size) < 0)
return -1;
}else if(frame_4cc == ff_get_fourcc("snd_")){
}else if(frame_4cc == AV_RL32("snd_")){
av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
......
......@@ -584,7 +584,7 @@ static av_cold int encode_init(AVCodecContext *avctx){
avctx->extradata= av_mallocz(8);
avctx->extradata_size=8;
((uint32_t*)avctx->extradata)[0]= le2me_32(a->inv_qscale);
((uint32_t*)avctx->extradata)[1]= le2me_32(ff_get_fourcc("ASUS"));
((uint32_t*)avctx->extradata)[1]= le2me_32(AV_RL32("ASUS"));
for(i=0; i<64; i++){
int q= 32*scale*ff_mpeg1_default_intra_matrix[i];
......
......@@ -114,7 +114,7 @@ max run: 29/41
static uint8_t static_rl_table_store[5][2][2*MAX_RUN + MAX_LEVEL + 3];
#if 0 //3IV1 is quite rare and it slows things down a tiny bit
#define IS_3IV1 s->codec_tag == ff_get_fourcc("3IV1")
#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
#else
#define IS_3IV1 0
#endif
......@@ -5223,7 +5223,7 @@ int h263_decode_picture_header(MpegEncContext *s)
show_pict_info(s);
}
#if 1
if (s->pict_type == FF_I_TYPE && s->codec_tag == ff_get_fourcc("ZYGO")){
if (s->pict_type == FF_I_TYPE && s->codec_tag == AV_RL32("ZYGO")){
int i,j;
for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
av_log(s->avctx, AV_LOG_DEBUG, "\n");
......@@ -5548,7 +5548,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
skip_bits1(gb); /* marker */
height = get_bits(gb, 13);
skip_bits1(gb); /* marker */
if(width && height && !(s->width && s->codec_tag == ff_get_fourcc("MP4S"))){ /* they should be non zero but who knows ... */
if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
s->width = width;
s->height = height;
// printf("width/height: %d %d\n", width, height);
......@@ -6062,7 +6062,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
/* search next start code */
align_get_bits(gb);
if(s->codec_tag == ff_get_fourcc("WV1F") && show_bits(gb, 24) == 0x575630){
if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630){
skip_bits(gb, 24);
if(get_bits(gb, 8) == 0xF0)
goto end;
......
......@@ -421,19 +421,19 @@ retry:
avctx->has_b_frames= !s->low_delay;
if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){
if(s->stream_codec_tag == ff_get_fourcc("XVID") ||
s->codec_tag == ff_get_fourcc("XVID") || s->codec_tag == ff_get_fourcc("XVIX") ||
s->codec_tag == ff_get_fourcc("RMP4"))
if(s->stream_codec_tag == AV_RL32("XVID") ||
s->codec_tag == AV_RL32("XVID") || s->codec_tag == AV_RL32("XVIX") ||
s->codec_tag == AV_RL32("RMP4"))
s->xvid_build= -1;
#if 0
if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==1
if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==1
&& s->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc
s->xvid_build= -1;
#endif
}
if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){
if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0)
if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==0)
s->divx_version= 400; //divx 4
}
......@@ -443,10 +443,10 @@ retry:
}
if(s->workaround_bugs&FF_BUG_AUTODETECT){
if(s->codec_tag == ff_get_fourcc("XVIX"))
if(s->codec_tag == AV_RL32("XVIX"))
s->workaround_bugs|= FF_BUG_XVID_ILACE;
if(s->codec_tag == ff_get_fourcc("UMP4")){
if(s->codec_tag == AV_RL32("UMP4")){
s->workaround_bugs|= FF_BUG_UMP4;
}
......
......@@ -335,7 +335,7 @@ av_cold int ff_xvid_encode_init(AVCodecContext *avctx) {
/* We are claiming to be Xvid */
x->quicktime_format = 0;
if(!avctx->codec_tag)
avctx->codec_tag = ff_get_fourcc("xvid");
avctx->codec_tag = AV_RL32("xvid");
}
/* Bframes */
......
......@@ -73,7 +73,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
*poutbuf_size = poutbufp - *poutbuf;
return 1;
case APP1:
if (i + 8 < buf_size && AV_RL32(buf + i + 8) == ff_get_fourcc("mjpg")) {
if (i + 8 < buf_size && AV_RL32(buf + i + 8) == AV_RL32("mjpg")) {
av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n");
memcpy(*poutbuf, buf, buf_size);
*poutbuf_size = buf_size;
......
......@@ -1040,7 +1040,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
/* buggy AVID, it puts EOI only at every 10th frame */
/* also this fourcc is used by non-avid files too, it holds some
informations, but it's always present in AVID creates files */
if (id == ff_get_fourcc("AVI1"))
if (id == AV_RL32("AVI1"))
{
/* structure:
4bytes AVI1
......@@ -1068,7 +1068,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
// len -= 2;
if (id == ff_get_fourcc("JFIF"))
if (id == AV_RL32("JFIF"))
{
int t_w, t_h, v1, v2;
skip_bits(&s->gb, 8); /* the trailing zero-byte */
......@@ -1098,7 +1098,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
goto out;
}
if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e'))
if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e'))
{
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
......@@ -1110,7 +1110,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
goto out;
}
if (id == ff_get_fourcc("LJIF")){
if (id == AV_RL32("LJIF")){
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
skip_bits(&s->gb, 16); /* version ? */
......@@ -1139,7 +1139,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
id = be2me_32(id);
len -= 4;
if (id == ff_get_fourcc("mjpg")) /* Apple MJPEG-A */
if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */
{
#if 0
skip_bits(&s->gb, 32); /* field size */
......
......@@ -2278,7 +2278,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
}
#endif
if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == ff_get_fourcc("VCR2"))
if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == AV_RL32("VCR2"))
vcr2_init_sequence(avctx);
s->slice_count= 0;
......
......@@ -305,7 +305,7 @@ static int shorten_decode_frame(AVCodecContext *avctx,
{
int maxnlpc = 0;
/* shorten signature */
if (get_bits_long(&s->gb, 32) != bswap_32(ff_get_fourcc("ajkg"))) {
if (get_bits_long(&s->gb, 32) != bswap_32(AV_RL32("ajkg"))) {
av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
return -1;
}
......
......@@ -209,11 +209,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
return -1;
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size);
if (show_bits_long(&s->gb, 32) == ff_get_fourcc("TTA1"))
if (show_bits_long(&s->gb, 32) == AV_RL32("TTA1"))
{
/* signature */
skip_bits(&s->gb, 32);
// if (get_bits_long(&s->gb, 32) != bswap_32(ff_get_fourcc("TTA1"))) {
// if (get_bits_long(&s->gb, 32) != bswap_32(AV_RL32("TTA1"))) {
// av_log(s->avctx, AV_LOG_ERROR, "Missing magic\n");
// return -1;
// }
......
......@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "libavutil/bswap.h"
#include "avformat.h"
#include "avi.h"
......@@ -517,7 +518,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->need_parsing = AVSTREAM_PARSE_NONE;
/* AVI files with Xan DPCM audio (wrongly) declare PCM
* audio in the header but have Axan as stream_code_tag. */
if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){
if (st->codec->stream_codec_tag == AV_RL32("Axan")){
st->codec->codec_id = CODEC_ID_XAN_DPCM;
st->codec->codec_tag = 0;
}
......
......@@ -41,7 +41,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
int i, channels, bps, samplerate, datalen, framelen;
uint64_t framepos;
if (get_le32(s->pb) != ff_get_fourcc("TTA1"))
if (get_le32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file
url_fskip(s->pb, 2); // FIXME: flags
......
......@@ -1946,8 +1946,8 @@ static int get_std_framerate(int i){
static int tb_unreliable(AVCodecContext *c){
if( c->time_base.den >= 101L*c->time_base.num
|| c->time_base.den < 5L*c->time_base.num
/* || c->codec_tag == ff_get_fourcc("DIVX")
|| c->codec_tag == ff_get_fourcc("XVID")*/
/* || c->codec_tag == AV_RL32("DIVX")
|| c->codec_tag == AV_RL32("XVID")*/
|| c->codec_id == CODEC_ID_MPEG2VIDEO)
return 1;
return 0;
......
......@@ -242,17 +242,6 @@ static inline av_const float av_clipf(float a, float amin, float amax)
else return a;
}
/**
* converts fourcc string to int
*/
static inline av_pure int ff_get_fourcc(const char *s){
#ifdef HAVE_AV_CONFIG_H
assert( strlen(s)==4 );
#endif
return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
}
#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment