mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
uses FF_ARRAY_ELEMS() where appropriate
Originally committed as revision 15662 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
03092e1408
commit
37d3e0667a
2
ffmpeg.c
2
ffmpeg.c
@ -1091,7 +1091,7 @@ static void print_report(AVFormatContext **output_files,
|
|||||||
if(qp_hist){
|
if(qp_hist){
|
||||||
int j;
|
int j;
|
||||||
int qp= lrintf(enc->coded_frame->quality/(float)FF_QP2LAMBDA);
|
int qp= lrintf(enc->coded_frame->quality/(float)FF_QP2LAMBDA);
|
||||||
if(qp>=0 && qp<sizeof(qp_histogram)/sizeof(int))
|
if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram))
|
||||||
qp_histogram[qp]++;
|
qp_histogram[qp]++;
|
||||||
for(j=0; j<32; j++)
|
for(j=0; j<32; j++)
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2)));
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2)));
|
||||||
|
@ -1341,7 +1341,7 @@ static int http_parse_request(HTTPContext *c)
|
|||||||
/* If this is WMP, get the rate information */
|
/* If this is WMP, get the rate information */
|
||||||
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
|
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
|
||||||
if (modify_current_stream(c, ratebuf)) {
|
if (modify_current_stream(c, ratebuf)) {
|
||||||
for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
|
||||||
if (c->switch_feed_streams[i] >= 0)
|
if (c->switch_feed_streams[i] >= 0)
|
||||||
do_switch_stream(c, i);
|
do_switch_stream(c, i);
|
||||||
}
|
}
|
||||||
|
@ -403,7 +403,7 @@ static av_cold int aac_decode_init(AVCodecContext * avccontext) {
|
|||||||
ff_aac_pow2sf_tab[i] = pow(2, (i - 200)/4.);
|
ff_aac_pow2sf_tab[i] = pow(2, (i - 200)/4.);
|
||||||
#endif /* CONFIG_HARDCODED_TABLES */
|
#endif /* CONFIG_HARDCODED_TABLES */
|
||||||
|
|
||||||
INIT_VLC_STATIC(&vlc_scalefactors, 7, sizeof(ff_aac_scalefactor_code)/sizeof(ff_aac_scalefactor_code[0]),
|
INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||||
ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
|
ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
|
||||||
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
|
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
|
||||||
352);
|
352);
|
||||||
|
@ -418,7 +418,7 @@ const CIDEntry ff_dnxhd_cid_table[] = {
|
|||||||
int ff_dnxhd_get_cid_table(int cid)
|
int ff_dnxhd_get_cid_table(int cid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++)
|
for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++)
|
||||||
if (ff_dnxhd_cid_table[i].cid == cid)
|
if (ff_dnxhd_cid_table[i].cid == cid)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
@ -430,7 +430,7 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx)
|
|||||||
int mbs = avctx->bit_rate/1000000;
|
int mbs = avctx->bit_rate/1000000;
|
||||||
if (!mbs)
|
if (!mbs)
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
|
||||||
const CIDEntry *cid = &ff_dnxhd_cid_table[i];
|
const CIDEntry *cid = &ff_dnxhd_cid_table[i];
|
||||||
if (cid->width == avctx->width && cid->height == avctx->height &&
|
if (cid->width == avctx->width && cid->height == avctx->height &&
|
||||||
cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
|
cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
|
||||||
|
@ -6386,7 +6386,7 @@ static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
|
|||||||
return &dv_profiles[2];
|
return &dv_profiles[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++)
|
for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
|
||||||
if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
|
if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
|
||||||
return &dv_profiles[i];
|
return &dv_profiles[i];
|
||||||
|
|
||||||
@ -6397,7 +6397,7 @@ static const DVprofile* dv_codec_profile(AVCodecContext* codec)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++)
|
for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
|
||||||
if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt &&
|
if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt &&
|
||||||
codec->width == dv_profiles[i].width)
|
codec->width == dv_profiles[i].width)
|
||||||
return &dv_profiles[i];
|
return &dv_profiles[i];
|
||||||
|
@ -587,7 +587,7 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){
|
|||||||
|
|
||||||
#endif //CONFIG_ENCODERS
|
#endif //CONFIG_ENCODERS
|
||||||
|
|
||||||
#define tab_size ((signed)(sizeof(s->direct_scale_mv[0])/sizeof(int16_t)))
|
#define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
|
||||||
#define tab_bias (tab_size/2)
|
#define tab_bias (tab_size/2)
|
||||||
|
|
||||||
void ff_mpeg4_init_direct_mv(MpegEncContext *s){
|
void ff_mpeg4_init_direct_mv(MpegEncContext *s){
|
||||||
|
@ -1979,7 +1979,7 @@ static av_cold void decode_init_vlc(void){
|
|||||||
* the packed static coeff_token_vlc table sizes
|
* the packed static coeff_token_vlc table sizes
|
||||||
* were initialized correctly.
|
* were initialized correctly.
|
||||||
*/
|
*/
|
||||||
assert(offset == sizeof(coeff_token_vlc_tables)/(sizeof(VLC_TYPE)*2));
|
assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables));
|
||||||
|
|
||||||
for(i=0; i<3; i++){
|
for(i=0; i<3; i++){
|
||||||
chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
|
chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
|
||||||
@ -6888,7 +6888,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
|||||||
if( aspect_ratio_idc == EXTENDED_SAR ) {
|
if( aspect_ratio_idc == EXTENDED_SAR ) {
|
||||||
sps->sar.num= get_bits(&s->gb, 16);
|
sps->sar.num= get_bits(&s->gb, 16);
|
||||||
sps->sar.den= get_bits(&s->gb, 16);
|
sps->sar.den= get_bits(&s->gb, 16);
|
||||||
}else if(aspect_ratio_idc < sizeof(pixel_aspect)/sizeof(*pixel_aspect)){
|
}else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
|
||||||
sps->sar= pixel_aspect[aspect_ratio_idc];
|
sps->sar= pixel_aspect[aspect_ratio_idc];
|
||||||
}else{
|
}else{
|
||||||
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
|
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
|
||||||
@ -7072,7 +7072,7 @@ static inline int decode_seq_parameter_set(H264Context *h){
|
|||||||
sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
|
sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
|
||||||
tmp= get_ue_golomb(&s->gb);
|
tmp= get_ue_golomb(&s->gb);
|
||||||
|
|
||||||
if(tmp >= sizeof(sps->offset_for_ref_frame) / sizeof(sps->offset_for_ref_frame[0])){
|
if(tmp >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
|
||||||
av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp);
|
av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
save_pgm("/tmp/in.pgm", img, XSIZE, YSIZE);
|
save_pgm("/tmp/in.pgm", img, XSIZE, YSIZE);
|
||||||
for(i=0;i<sizeof(factors)/sizeof(float);i++) {
|
for(i=0;i<FF_ARRAY_ELEMS(factors);i++) {
|
||||||
fact = factors[i];
|
fact = factors[i];
|
||||||
xsize = (int)(XSIZE * fact);
|
xsize = (int)(XSIZE * fact);
|
||||||
ysize = (int)((YSIZE - 100) * fact);
|
ysize = (int)((YSIZE - 100) * fact);
|
||||||
|
@ -110,7 +110,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
|
|||||||
ctx->prev_index = 0;
|
ctx->prev_index = 0;
|
||||||
ctx->cur_index = 15;
|
ctx->cur_index = 15;
|
||||||
|
|
||||||
if(init_vlc(&ctx->vlc, 11, sizeof(huffbits)/sizeof(huffbits[0]),
|
if(init_vlc(&ctx->vlc, 11, FF_ARRAY_ELEMS(huffbits),
|
||||||
huffbits, 1, 1, huffcodes, 4, 4, 0)) {
|
huffbits, 1, 1, huffcodes, 4, 4, 0)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
|
av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -394,7 +394,7 @@ static int decode_init(AVCodecContext * avctx)
|
|||||||
INIT_VLC_USE_NEW_STATIC);
|
INIT_VLC_USE_NEW_STATIC);
|
||||||
offset += huff_vlc_tables_sizes[i];
|
offset += huff_vlc_tables_sizes[i];
|
||||||
}
|
}
|
||||||
assert(offset == sizeof(huff_vlc_tables)/(sizeof(VLC_TYPE)*2));
|
assert(offset == FF_ARRAY_ELEMS(huff_vlc_tables));
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
for(i=0;i<2;i++) {
|
for(i=0;i<2;i++) {
|
||||||
@ -405,7 +405,7 @@ static int decode_init(AVCodecContext * avctx)
|
|||||||
INIT_VLC_USE_NEW_STATIC);
|
INIT_VLC_USE_NEW_STATIC);
|
||||||
offset += huff_quad_vlc_tables_sizes[i];
|
offset += huff_quad_vlc_tables_sizes[i];
|
||||||
}
|
}
|
||||||
assert(offset == sizeof(huff_quad_vlc_tables)/(sizeof(VLC_TYPE)*2));
|
assert(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables));
|
||||||
|
|
||||||
for(i=0;i<9;i++) {
|
for(i=0;i<9;i++) {
|
||||||
k = 0;
|
k = 0;
|
||||||
|
@ -1455,7 +1455,7 @@ static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
|
|||||||
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
|
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr);
|
int n = FF_ARRAY_ELEMS(video_frame_size_abbrs);
|
||||||
const char *p;
|
const char *p;
|
||||||
int frame_width = 0, frame_height = 0;
|
int frame_width = 0, frame_height = 0;
|
||||||
|
|
||||||
@ -1483,7 +1483,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
|
|||||||
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
|
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int n = sizeof(video_frame_rate_abbrs) / sizeof(VideoFrameRateAbbr);
|
int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs);
|
||||||
char* cp;
|
char* cp;
|
||||||
|
|
||||||
/* First, we check our abbreviation table */
|
/* First, we check our abbreviation table */
|
||||||
|
@ -213,7 +213,7 @@ static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccon
|
|||||||
venc->sample_rate = avccontext->sample_rate;
|
venc->sample_rate = avccontext->sample_rate;
|
||||||
venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
|
venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
|
||||||
|
|
||||||
venc->ncodebooks = sizeof(cvectors)/sizeof(cvectors[0]);
|
venc->ncodebooks = FF_ARRAY_ELEMS(cvectors);
|
||||||
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
|
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
|
||||||
|
|
||||||
// codebook 0..14 - floor1 book, values 0..255
|
// codebook 0..14 - floor1 book, values 0..255
|
||||||
|
@ -78,7 +78,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
struct video_audio audio;
|
struct video_audio audio;
|
||||||
struct video_picture pict;
|
struct video_picture pict;
|
||||||
int j;
|
int j;
|
||||||
int vformat_num = sizeof(video_formats) / sizeof(video_formats[0]);
|
int vformat_num = FF_ARRAY_ELEMS(video_formats);
|
||||||
|
|
||||||
if (ap->width <= 0 || ap->height <= 0) {
|
if (ap->width <= 0 || ap->height <= 0) {
|
||||||
av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
|
av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
|
||||||
|
@ -221,7 +221,7 @@ static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(fmt_conversion_table) / sizeof(struct fmt_map); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
|
||||||
if (fmt_conversion_table[i].ff_fmt == pix_fmt) {
|
if (fmt_conversion_table[i].ff_fmt == pix_fmt) {
|
||||||
return fmt_conversion_table[i].v4l2_fmt;
|
return fmt_conversion_table[i].v4l2_fmt;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ static enum PixelFormat fmt_v4l2ff(uint32_t pix_fmt)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(fmt_conversion_table) / sizeof(struct fmt_map); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
|
||||||
if (fmt_conversion_table[i].v4l2_fmt == pix_fmt) {
|
if (fmt_conversion_table[i].v4l2_fmt == pix_fmt) {
|
||||||
return fmt_conversion_table[i].ff_fmt;
|
return fmt_conversion_table[i].ff_fmt;
|
||||||
}
|
}
|
||||||
@ -563,7 +563,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
} else {
|
} else {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
if (i == sizeof(fmt_conversion_table) / sizeof(struct fmt_map)) {
|
if (i == FF_ARRAY_ELEMS(fmt_conversion_table)) {
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ static int shall_we_drop(struct vfw_ctx *ctx)
|
|||||||
{
|
{
|
||||||
AVFormatContext *s = ctx->s;
|
AVFormatContext *s = ctx->s;
|
||||||
const uint8_t dropscore[] = {62, 75, 87, 100};
|
const uint8_t dropscore[] = {62, 75, 87, 100};
|
||||||
const int ndropscores = sizeof(dropscore)/sizeof(dropscore[0]);
|
const int ndropscores = FF_ARRAY_ELEMS(dropscore);
|
||||||
unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
|
unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
|
||||||
|
|
||||||
if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
|
if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
|
||||||
|
@ -88,7 +88,7 @@ static int infer_size(int *width_ptr, int *height_ptr, int size)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;i<sizeof(sizes)/sizeof(sizes[0]);i++) {
|
for(i=0;i<FF_ARRAY_ELEMS(sizes);i++) {
|
||||||
if ((sizes[i][0] * sizes[i][1]) == size) {
|
if ((sizes[i][0] * sizes[i][1]) == size) {
|
||||||
*width_ptr = sizes[i][0];
|
*width_ptr = sizes[i][0];
|
||||||
*height_ptr = sizes[i][1];
|
*height_ptr = sizes[i][1];
|
||||||
|
@ -248,7 +248,7 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4)
|
|||||||
int i, code = 0;
|
int i, code = 0;
|
||||||
|
|
||||||
/* old way, only for QT? */
|
/* old way, only for QT? */
|
||||||
for (i = 0; !mp4 && (i < (sizeof(mov_mdhd_language_map)/sizeof(char *))); i++) {
|
for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
|
||||||
if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))
|
if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i]))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ int ff_mov_lang_to_iso639(int code, char *to)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* old fashion apple lang code */
|
/* old fashion apple lang code */
|
||||||
if (code >= (sizeof(mov_mdhd_language_map)/sizeof(char *)))
|
if (code >= FF_ARRAY_ELEMS(mov_mdhd_language_map))
|
||||||
return 0;
|
return 0;
|
||||||
if (!mov_mdhd_language_map[code])
|
if (!mov_mdhd_language_map[code])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -226,8 +226,6 @@ typedef struct {
|
|||||||
EbmlList blocks;
|
EbmlList blocks;
|
||||||
} MatroskaCluster;
|
} MatroskaCluster;
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x))
|
|
||||||
|
|
||||||
static EbmlSyntax ebml_header[] = {
|
static EbmlSyntax ebml_header[] = {
|
||||||
{ EBML_ID_EBMLREADVERSION, EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} },
|
{ EBML_ID_EBMLREADVERSION, EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} },
|
||||||
{ EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} },
|
{ EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} },
|
||||||
@ -980,7 +978,7 @@ static void matroska_convert_tags(AVFormatContext *s, EbmlList *list)
|
|||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i=0; i < list->nb_elem; i++) {
|
for (i=0; i < list->nb_elem; i++) {
|
||||||
for (j=0; j < ARRAY_SIZE(metadata); j++){
|
for (j=0; j < FF_ARRAY_ELEMS(metadata); j++){
|
||||||
if (!strcmp(tags[i].name, metadata[j].name)) {
|
if (!strcmp(tags[i].name, metadata[j].name)) {
|
||||||
int *ptr = (int *)((char *)s + metadata[j].offset);
|
int *ptr = (int *)((char *)s + metadata[j].offset);
|
||||||
if (*ptr) continue;
|
if (*ptr) continue;
|
||||||
@ -1050,7 +1048,7 @@ static int matroska_aac_profile(char *codec_id)
|
|||||||
static const char * const aac_profiles[] = { "MAIN", "LC", "SSR" };
|
static const char * const aac_profiles[] = { "MAIN", "LC", "SSR" };
|
||||||
int profile;
|
int profile;
|
||||||
|
|
||||||
for (profile=0; profile<ARRAY_SIZE(aac_profiles); profile++)
|
for (profile=0; profile<FF_ARRAY_ELEMS(aac_profiles); profile++)
|
||||||
if (strstr(codec_id, aac_profiles[profile]))
|
if (strstr(codec_id, aac_profiles[profile]))
|
||||||
break;
|
break;
|
||||||
return profile + 1;
|
return profile + 1;
|
||||||
@ -1060,7 +1058,7 @@ static int matroska_aac_sri(int samplerate)
|
|||||||
{
|
{
|
||||||
int sri;
|
int sri;
|
||||||
|
|
||||||
for (sri=0; sri<ARRAY_SIZE(ff_mpeg4audio_sample_rates); sri++)
|
for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++)
|
||||||
if (ff_mpeg4audio_sample_rates[sri] == samplerate)
|
if (ff_mpeg4audio_sample_rates[sri] == samplerate)
|
||||||
break;
|
break;
|
||||||
return sri;
|
return sri;
|
||||||
|
@ -74,8 +74,7 @@ static const MXFContainerEssenceEntry mxf_essence_container_uls[] = {
|
|||||||
typedef struct MXFContext {
|
typedef struct MXFContext {
|
||||||
int64_t footer_partition_offset;
|
int64_t footer_partition_offset;
|
||||||
int essence_container_count;
|
int essence_container_count;
|
||||||
uint8_t essence_containers_indices[sizeof(mxf_essence_container_uls)/
|
uint8_t essence_containers_indices[FF_ARRAY_ELEMS(mxf_essence_container_uls)];
|
||||||
sizeof(*mxf_essence_container_uls)];
|
|
||||||
} MXFContext;
|
} MXFContext;
|
||||||
|
|
||||||
static const uint8_t uuid_base[] = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
|
static const uint8_t uuid_base[] = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
|
||||||
@ -207,8 +206,7 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
|
|||||||
static int mxf_get_essence_container_ul_index(enum CodecID id)
|
static int mxf_get_essence_container_ul_index(enum CodecID id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < sizeof(mxf_essence_container_uls)/
|
for (i = 0; i < FF_ARRAY_ELEMS(mxf_essence_container_uls); i++)
|
||||||
sizeof(*mxf_essence_container_uls); i++)
|
|
||||||
if (mxf_essence_container_uls[i].id == id)
|
if (mxf_essence_container_uls[i].id == id)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
@ -219,7 +217,7 @@ static void mxf_write_primer_pack(AVFormatContext *s)
|
|||||||
ByteIOContext *pb = s->pb;
|
ByteIOContext *pb = s->pb;
|
||||||
int local_tag_number, i = 0;
|
int local_tag_number, i = 0;
|
||||||
|
|
||||||
local_tag_number = sizeof(mxf_local_tag_batch)/sizeof(*mxf_local_tag_batch);
|
local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch);
|
||||||
|
|
||||||
put_buffer(pb, primer_pack_key, 16);
|
put_buffer(pb, primer_pack_key, 16);
|
||||||
klv_encode_ber_length(pb, local_tag_number * 18 + 8);
|
klv_encode_ber_length(pb, local_tag_number * 18 + 8);
|
||||||
@ -754,8 +752,7 @@ static int mxf_write_header(AVFormatContext *s)
|
|||||||
{
|
{
|
||||||
MXFContext *mxf = s->priv_data;
|
MXFContext *mxf = s->priv_data;
|
||||||
int i;
|
int i;
|
||||||
uint8_t present[sizeof(mxf_essence_container_uls)/
|
uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0};
|
||||||
sizeof(*mxf_essence_container_uls)] = {0};
|
|
||||||
|
|
||||||
for (i = 0; i < s->nb_streams; i++) {
|
for (i = 0; i < s->nb_streams; i++) {
|
||||||
AVStream *st = s->streams[i];
|
AVStream *st = s->streams[i];
|
||||||
|
@ -2904,7 +2904,7 @@ int64_t parse_date(const char *datestr, int duration)
|
|||||||
q = NULL;
|
q = NULL;
|
||||||
if (!duration) {
|
if (!duration) {
|
||||||
/* parse the year-month-day part */
|
/* parse the year-month-day part */
|
||||||
for (i = 0; i < sizeof(date_fmt) / sizeof(date_fmt[0]); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
|
||||||
q = small_strptime(p, date_fmt[i], &dt);
|
q = small_strptime(p, date_fmt[i], &dt);
|
||||||
if (q) {
|
if (q) {
|
||||||
break;
|
break;
|
||||||
@ -2928,7 +2928,7 @@ int64_t parse_date(const char *datestr, int duration)
|
|||||||
p++;
|
p++;
|
||||||
|
|
||||||
/* parse the hour-minute-second part */
|
/* parse the hour-minute-second part */
|
||||||
for (i = 0; i < sizeof(time_fmt) / sizeof(time_fmt[0]); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) {
|
||||||
q = small_strptime(p, time_fmt[i], &dt);
|
q = small_strptime(p, time_fmt[i], &dt);
|
||||||
if (q) {
|
if (q) {
|
||||||
break;
|
break;
|
||||||
|
@ -51,7 +51,7 @@ int av_base64_decode(uint8_t * out, const char *in, int out_length)
|
|||||||
v = 0;
|
v = 0;
|
||||||
for (i = 0; in[i] && in[i] != '='; i++) {
|
for (i = 0; in[i] && in[i] != '='; i++) {
|
||||||
unsigned int index= in[i]-43;
|
unsigned int index= in[i]-43;
|
||||||
if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff)
|
if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff)
|
||||||
return -1;
|
return -1;
|
||||||
v = (v << 6) + map2[index];
|
v = (v << 6) + map2[index];
|
||||||
if (i & 3) {
|
if (i & 3) {
|
||||||
|
@ -91,7 +91,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
|
|||||||
*/
|
*/
|
||||||
const AVCRC *av_crc_get_table(AVCRCId crc_id){
|
const AVCRC *av_crc_get_table(AVCRCId crc_id){
|
||||||
#ifndef CONFIG_HARDCODED_TABLES
|
#ifndef CONFIG_HARDCODED_TABLES
|
||||||
if (!av_crc_table[crc_id][sizeof(av_crc_table[crc_id])/sizeof(av_crc_table[crc_id][0])-1])
|
if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1])
|
||||||
if (av_crc_init(av_crc_table[crc_id],
|
if (av_crc_init(av_crc_table[crc_id],
|
||||||
av_crc_table_params[crc_id].le,
|
av_crc_table_params[crc_id].le,
|
||||||
av_crc_table_params[crc_id].bits,
|
av_crc_table_params[crc_id].bits,
|
||||||
|
Loading…
Reference in New Issue
Block a user