Пример #1
0
void
mpeg4_p2_video_packetizer_c::extract_size(const unsigned char *buffer,
        int size) {
    if (m_size_extracted)
        return;

    if (0 != m_connected_to) {
        m_size_extracted = true;
        return;
    }

    uint32_t xtr_width, xtr_height;

    if (mpeg4::p2::extract_size(buffer, size, xtr_width, xtr_height)) {
        m_size_extracted = true;

        if (!m_reader->m_appending && ((xtr_width != static_cast<uint32_t>(m_hvideo_pixel_width)) || (xtr_height != static_cast<uint32_t>(m_hvideo_pixel_height)))) {
            set_video_pixel_width(xtr_width);
            set_video_pixel_height(xtr_height);

            if (!m_output_is_native && m_ti.m_private_data && (sizeof(alBITMAPINFOHEADER) <= m_ti.m_private_data->get_size())) {
                auto bih = reinterpret_cast<alBITMAPINFOHEADER *>(m_ti.m_private_data->get_buffer());
                put_uint32_le(&bih->bi_width,  xtr_width);
                put_uint32_le(&bih->bi_height, xtr_height);
                set_codec_private(m_ti.m_private_data);
            }

            m_hvideo_display_width  = -1;
            m_hvideo_display_height = -1;

            generic_packetizer_c::set_headers();
            rerender_track_headers();

            mxinfo_tid(m_ti.m_fname, m_ti.m_id,
                       boost::format(Y("The extracted values for video width and height from the MPEG4 layer 2 video data bitstream differ from what the values "
                                       "in the source container. The ones from the video data bitstream (%1%x%2%) will be used.\n")) % xtr_width % xtr_height);
        }

    } else if (50 <= m_frames_output)
        m_aspect_ratio_extracted = true;
}
void
generic_packetizer_c::set_video_pixel_dimensions(int width,
                                                 int height) {
  set_video_pixel_width(width);
  set_video_pixel_height(height);
}