|
|
@ -405,51 +405,51 @@ static int ffm2_read_header(AVFormatContext *s) |
|
|
|
ret = av_image_check_size(codec->width, codec->height, 0, s); |
|
|
|
ret = av_image_check_size(codec->width, codec->height, 0, s); |
|
|
|
if (ret < 0) |
|
|
|
if (ret < 0) |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
codec->gop_size = avio_rb16(pb); |
|
|
|
avio_rb16(pb); // gop_size
|
|
|
|
codec->pix_fmt = avio_rb32(pb); |
|
|
|
codec->pix_fmt = avio_rb32(pb); |
|
|
|
if (!av_pix_fmt_desc_get(codec->pix_fmt)) { |
|
|
|
if (!av_pix_fmt_desc_get(codec->pix_fmt)) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt); |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt); |
|
|
|
codec->pix_fmt = AV_PIX_FMT_NONE; |
|
|
|
codec->pix_fmt = AV_PIX_FMT_NONE; |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} |
|
|
|
codec->qmin = avio_r8(pb); |
|
|
|
avio_r8(pb); // qmin
|
|
|
|
codec->qmax = avio_r8(pb); |
|
|
|
avio_r8(pb); // qmax
|
|
|
|
codec->max_qdiff = avio_r8(pb); |
|
|
|
avio_r8(pb); // max_qdiff
|
|
|
|
codec->qcompress = avio_rb16(pb) / 10000.0; |
|
|
|
avio_rb16(pb); // qcompress / 10000.0
|
|
|
|
codec->qblur = avio_rb16(pb) / 10000.0; |
|
|
|
avio_rb16(pb); // qblur / 10000.0
|
|
|
|
codec->bit_rate_tolerance = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // bit_rate_tolerance
|
|
|
|
avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); |
|
|
|
avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); |
|
|
|
codec->rc_eq = av_strdup(rc_eq_buf); |
|
|
|
|
|
|
|
codec->rc_max_rate = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_max_rate
|
|
|
|
codec->rc_min_rate = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_min_rate
|
|
|
|
codec->rc_buffer_size = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_buffer_size
|
|
|
|
codec->i_quant_factor = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // i_quant_factor
|
|
|
|
codec->b_quant_factor = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // b_quant_factor
|
|
|
|
codec->i_quant_offset = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // i_quant_offset
|
|
|
|
codec->b_quant_offset = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // b_quant_offset
|
|
|
|
codec->dct_algo = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // dct_algo
|
|
|
|
codec->strict_std_compliance = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // strict_std_compliance
|
|
|
|
codec->max_b_frames = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // max_b_frames
|
|
|
|
codec->mpeg_quant = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // mpeg_quant
|
|
|
|
codec->intra_dc_precision = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // intra_dc_precision
|
|
|
|
codec->me_method = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_method
|
|
|
|
codec->mb_decision = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // mb_decision
|
|
|
|
codec->nsse_weight = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // nsse_weight
|
|
|
|
codec->frame_skip_cmp = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // frame_skip_cmp
|
|
|
|
codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // rc_buffer_aggressivity
|
|
|
|
codec->codec_tag = avio_rb32(pb); |
|
|
|
codec->codec_tag = avio_rb32(pb); |
|
|
|
codec->thread_count = avio_r8(pb); |
|
|
|
avio_r8(pb); // thread_count
|
|
|
|
codec->coder_type = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // coder_type
|
|
|
|
codec->me_cmp = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_cmp
|
|
|
|
codec->me_subpel_quality = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_subpel_quality
|
|
|
|
codec->me_range = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_range
|
|
|
|
codec->keyint_min = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // keyint_min
|
|
|
|
codec->scenechange_threshold = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // scenechange_threshold
|
|
|
|
codec->b_frame_strategy = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // b_frame_strategy
|
|
|
|
codec->qcompress = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // qcompress
|
|
|
|
codec->qblur = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // qblur
|
|
|
|
codec->max_qdiff = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // max_qdiff
|
|
|
|
codec->refs = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // refs
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case MKBETAG('S', 'T', 'A', 'U'): |
|
|
|
case MKBETAG('S', 'T', 'A', 'U'): |
|
|
|
if (f_stau++) { |
|
|
|
if (f_stau++) { |
|
|
@ -614,51 +614,51 @@ static int ffm_read_header(AVFormatContext *s) |
|
|
|
codec->height = avio_rb16(pb); |
|
|
|
codec->height = avio_rb16(pb); |
|
|
|
if (av_image_check_size(codec->width, codec->height, 0, s) < 0) |
|
|
|
if (av_image_check_size(codec->width, codec->height, 0, s) < 0) |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
codec->gop_size = avio_rb16(pb); |
|
|
|
avio_rb16(pb); // gop_size
|
|
|
|
codec->pix_fmt = avio_rb32(pb); |
|
|
|
codec->pix_fmt = avio_rb32(pb); |
|
|
|
if (!av_pix_fmt_desc_get(codec->pix_fmt)) { |
|
|
|
if (!av_pix_fmt_desc_get(codec->pix_fmt)) { |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt); |
|
|
|
av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt); |
|
|
|
codec->pix_fmt = AV_PIX_FMT_NONE; |
|
|
|
codec->pix_fmt = AV_PIX_FMT_NONE; |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} |
|
|
|
codec->qmin = avio_r8(pb); |
|
|
|
avio_r8(pb); // qmin
|
|
|
|
codec->qmax = avio_r8(pb); |
|
|
|
avio_r8(pb); // qmax
|
|
|
|
codec->max_qdiff = avio_r8(pb); |
|
|
|
avio_r8(pb); // max_qdiff
|
|
|
|
codec->qcompress = avio_rb16(pb) / 10000.0; |
|
|
|
avio_rb16(pb); // qcompress / 10000.0
|
|
|
|
codec->qblur = avio_rb16(pb) / 10000.0; |
|
|
|
avio_rb16(pb); // qblur / 10000.0
|
|
|
|
codec->bit_rate_tolerance = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // bit_rate_tolerance
|
|
|
|
avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); |
|
|
|
avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); |
|
|
|
codec->rc_eq = av_strdup(rc_eq_buf); |
|
|
|
|
|
|
|
codec->rc_max_rate = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_max_rate
|
|
|
|
codec->rc_min_rate = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_min_rate
|
|
|
|
codec->rc_buffer_size = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // rc_buffer_size
|
|
|
|
codec->i_quant_factor = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // i_quant_factor
|
|
|
|
codec->b_quant_factor = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // b_quant_factor
|
|
|
|
codec->i_quant_offset = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // i_quant_offset
|
|
|
|
codec->b_quant_offset = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // b_quant_offset
|
|
|
|
codec->dct_algo = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // dct_algo
|
|
|
|
codec->strict_std_compliance = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // strict_std_compliance
|
|
|
|
codec->max_b_frames = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // max_b_frames
|
|
|
|
codec->mpeg_quant = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // mpeg_quant
|
|
|
|
codec->intra_dc_precision = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // intra_dc_precision
|
|
|
|
codec->me_method = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_method
|
|
|
|
codec->mb_decision = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // mb_decision
|
|
|
|
codec->nsse_weight = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // nsse_weight
|
|
|
|
codec->frame_skip_cmp = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // frame_skip_cmp
|
|
|
|
codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // rc_buffer_aggressivity
|
|
|
|
codec->codec_tag = avio_rb32(pb); |
|
|
|
codec->codec_tag = avio_rb32(pb); |
|
|
|
codec->thread_count = avio_r8(pb); |
|
|
|
avio_r8(pb); // thread_count
|
|
|
|
codec->coder_type = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // coder_type
|
|
|
|
codec->me_cmp = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_cmp
|
|
|
|
codec->me_subpel_quality = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_subpel_quality
|
|
|
|
codec->me_range = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // me_range
|
|
|
|
codec->keyint_min = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // keyint_min
|
|
|
|
codec->scenechange_threshold = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // scenechange_threshold
|
|
|
|
codec->b_frame_strategy = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // b_frame_strategy
|
|
|
|
codec->qcompress = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // qcompress
|
|
|
|
codec->qblur = av_int2double(avio_rb64(pb)); |
|
|
|
avio_rb64(pb); // qblur
|
|
|
|
codec->max_qdiff = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // max_qdiff
|
|
|
|
codec->refs = avio_rb32(pb); |
|
|
|
avio_rb32(pb); // refs
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case AVMEDIA_TYPE_AUDIO: |
|
|
|
case AVMEDIA_TYPE_AUDIO: |
|
|
|
codec->sample_rate = avio_rb32(pb); |
|
|
|
codec->sample_rate = avio_rb32(pb); |
|
|
|