xine-lib: xine-lib-1.2.12/src/video_dec/libmpeg2/decode.c File Reference

xine-lib 1.2.12

Macros | Functions
decode.c File Reference
`#include "config.h"`
`#include <stdio.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <inttypes.h>`
`#include <math.h>`
`#include <xine/xine_internal.h>`
`#include <xine/video_out.h>`
`#include "mpeg2.h"`
`#include "mpeg2_internal.h"`
`#include <xine/xineutils.h>`
`#include "libmpeg2_accel.h"`

## Macros
#define | LOG_MODULE "decode"
#define | LOG_VERBOSE
#define | BUFFER_SIZE (1194 * 1024) /* new buffer size for mpeg2dec 0.2.1 */

## Functions
static void | process_userdata (mpeg2dec_t *mpeg2dec, uint8_t *buffer)
void | mpeg2_init (mpeg2dec_t *mpeg2dec, xine_video_port_t *output)
static void | get_frame_duration (mpeg2dec_t *mpeg2dec, vo_frame_t *frame)
static double | get_aspect_ratio (mpeg2dec_t *mpeg2dec)
static void | remember_metainfo (mpeg2dec_t *mpeg2dec)
static int | parse_chunk (mpeg2dec_t *mpeg2dec, int code, uint8_t *buffer, int next_code)
static int | find_start_code (mpeg2dec_t *mpeg2dec, uint8_t **current, uint8_t *limit)
static uint8_t * | copy_chunk (mpeg2dec_t *mpeg2dec, uint8_t *current, uint8_t *end)
int | mpeg2_decode_data (mpeg2dec_t *mpeg2dec, uint8_t *current, uint8_t *end, uint64_t pts)
void | mpeg2_discontinuity (mpeg2dec_t *mpeg2dec)
void | mpeg2_reset (mpeg2dec_t *mpeg2dec)
void | mpeg2_flush (mpeg2dec_t *mpeg2dec)
void | mpeg2_close (mpeg2dec_t *mpeg2dec)
void | mpeg2_find_sequence_header (mpeg2dec_t *mpeg2dec, uint8_t *current, uint8_t *end)
static uint8_t * | find_end (uint8_t *buffer)

## Macro Definition Documentation

## ◆ BUFFER_SIZE

#define BUFFER_SIZE (1194 * 1024) /* new buffer size for mpeg2dec 0.2.1 */

## ◆ LOG_MODULE

#define LOG_MODULE "decode"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## Function Documentation

## ◆ copy_chunk()

static uint8_t * copy_chunk | ( | mpeg2dec_t * | mpeg2dec,
|  | uint8_t * | current,
|  | uint8_t * | end
| ) |  |
| inlinestatic

References BUFFER_SIZE, mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_ptr, mpeg2dec_s::chunk_size, mpeg2dec_s::code, find_start_code(), NULL, mpeg2dec_s::shift, and xine_fast_memcpy.

Referenced by mpeg2_decode_data(), mpeg2_find_sequence_header(), mpeg2_parse(), and mpeg2_parse_header().

## ◆ find_end()

static uint8_t * find_end | ( | uint8_t * | buffer | ) |
| static

Referenced by process_userdata().

## ◆ find_start_code()

static int find_start_code | ( | mpeg2dec_t * | mpeg2dec,
|  | uint8_t ** | current,
|  | uint8_t * | limit
| ) |  |
| inlinestatic

References mpeg2dec_s::shift.

Referenced by copy_chunk().

## ◆ get_aspect_ratio()

static double get_aspect_ratio | ( | mpeg2dec_t * | mpeg2dec | ) |
| static

References mpeg2dec_s::picture.

Referenced by parse_chunk(), and remember_metainfo().

## ◆ get_frame_duration()

static void get_frame_duration | ( | mpeg2dec_t * | mpeg2dec,
|  | vo_frame_t * | frame
| ) |  |
| inlinestatic

References _x_stream_info_set(), vo_frame_s::duration, picture_s::frame_rate_code, picture_s::frame_rate_ext_d, picture_s::frame_rate_ext_n, mpeg2dec_s::picture, vo_frame_s::progressive_frame, picture_s::progressive_sequence, vo_frame_s::repeat_first_field, mpeg2dec_s::rff_pattern, mpeg2dec_s::stream, vo_frame_s::top_field_first, and XINE_STREAM_INFO_FRAME_DURATION.

Referenced by mpeg2_close(), mpeg2_flush(), and parse_chunk().

## ◆ mpeg2_close()

void mpeg2_close | ( | mpeg2dec_t * | mpeg2dec | ) |

References mpeg2dec_s::cc_dec, mpeg2dec_s::chunk_buffer, spu_decoder_s::dispose, get_frame_duration(), lprintf, NULL, mpeg2dec_s::picture, mpeg2dec_s::stream, and xine_freep_aligned.

Referenced by mpeg2_video_dispose(), and mpeg2dec_dispose().

## ◆ mpeg2_decode_data()

int mpeg2_decode_data | ( | mpeg2dec_t * | mpeg2dec,
|  | uint8_t * | current,
|  | uint8_t * | end,
|  | uint64_t | pts
| ) |  |

References mpeg2dec_s::accel, mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_ptr, mpeg2dec_s::code, code, copy_chunk(), mpeg2dec_s::frame_format, mpeg2dec_s::is_frame_needed, libmpeg2_accel_frame_completion(), NULL, parse_chunk(), mpeg2dec_s::picture, mpeg2dec_s::pts, mpeg2dec_s::seek_mode, and mpeg2dec_s::shift.

Referenced by mpeg2dec_decode_data().

## ◆ mpeg2_discontinuity()

void mpeg2_discontinuity | ( | mpeg2dec_t * | mpeg2dec | ) |

References mpeg2dec_s::accel, mpeg2dec_s::frame_format, mpeg2dec_s::in_slice, libmpeg2_accel_discontinuity(), mpeg2dec_s::picture, and mpeg2dec_s::pts.

Referenced by mpeg2_reset(), and mpeg2dec_discontinuity().

## ◆ mpeg2_find_sequence_header()

void mpeg2_find_sequence_header | ( | mpeg2dec_t * | mpeg2dec,
|  | uint8_t * | current,
|  | uint8_t * | end
| ) |  |

References _x_stream_info_set(), xine_format_change_data_t::aspect, mpeg2dec_s::chunk_buffer, mpeg2dec_s::code, code, copy_chunk(), mpeg2dec_s::force_aspect, mpeg2dec_s::force_pan_scan, xine_format_change_data_t::height, mpeg2dec_s::is_sequence_needed, mpeg2_header_extension(), mpeg2_header_sequence(), mpeg2_stats(), mpeg2dec_s::new_sequence, NULL, xine_format_change_data_t::pan_scan, mpeg2dec_s::picture, remember_metainfo(), mpeg2dec_s::seek_mode, mpeg2dec_s::stream, xine_format_change_data_t::width, XINE_EVENT_FRAME_FORMAT_CHANGE, xine_event_send(), XINE_STREAM_INFO_VIDEO_HEIGHT, and XINE_STREAM_INFO_VIDEO_WIDTH.

Referenced by mpeg2dec_decode_data().

## ◆ mpeg2_flush()

void mpeg2_flush | ( | mpeg2dec_t * | mpeg2dec | ) |

References get_frame_duration(), lprintf, mpeg2dec_s::picture, and mpeg2dec_s::stream.

Referenced by mpeg2dec_flush(), and parse_chunk().

## ◆ mpeg2_init()

void mpeg2_init | ( | mpeg2dec_t * | mpeg2dec,
|  | xine_video_port_t * | output
| ) |  |

References mpeg2dec_s::accel, mpeg2dec_s::afd_value_reported, mpeg2dec_s::afd_value_seen, BUFFER_SIZE, mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_ptr, mpeg2dec_s::code, mpeg2dec_s::drop_frame, mpeg2dec_s::frame_format, mpeg2dec_s::frames_to_drop, xine_video_port_s::get_capabilities, mpeg2dec_s::in_slice, mpeg2dec_s::is_sequence_needed, mpeg2dec_s::is_wait_for_ip_frames, libmpeg2_accel_scan(), mpeg2_cpu_state_init(), mpeg2_header_state_init(), mpeg2_idct_init(), mpeg2_mc_init(), mpeg2_scan_alt, mpeg2_scan_norm, mpeg2dec_s::new_sequence, mpeg2dec_s::output, mpeg2dec_s::picture, mpeg2dec_s::seek_mode, mpeg2dec_s::shift, VO_CAP_XVMC_MOCOMP, VO_CAP_XXMC, XINE_IMGFMT_XVMC, XINE_IMGFMT_XXMC, XINE_IMGFMT_YV12, xine_mallocz_aligned(), xine_mm_accel(), and XINE_VIDEO_AFD_NOT_PRESENT.

## ◆ mpeg2_reset()

void mpeg2_reset | ( | mpeg2dec_t * | mpeg2dec | ) |

References mpeg2dec_s::in_slice, mpeg2dec_s::is_wait_for_ip_frames, mpeg2_discontinuity(), NULL, mpeg2dec_s::picture, and mpeg2dec_s::seek_mode.

Referenced by mpeg2_init(), mpeg2_video_reset(), and mpeg2dec_reset().

## ◆ parse_chunk()

static int parse_chunk | ( | mpeg2dec_t * | mpeg2dec,
|  | int | code,
|  | uint8_t * | buffer,
|  | int | next_code
| ) |  |
| inlinestatic

References _x_stream_info_set(), mpeg2dec_s::accel, mpeg2dec_s::afd_value_reported, mpeg2dec_s::afd_value_seen, xine_format_change_data_t::aspect, B_TYPE, vo_frame_s::bad_frame, mpeg2dec_s::chunk_buffer, mpeg2dec_s::chunk_size, code, picture_s::current_frame, D_TYPE, mpeg2dec_s::drop_frame, picture_t::field, mpeg2dec_s::force_aspect, mpeg2dec_s::force_pan_scan, mpeg2dec_s::frame_format, FRAME_PICTURE, mpeg2dec_s::frames_to_drop, get_aspect_ratio(), xine_video_port_s::get_frame, get_frame_duration(), xine_format_change_data_t::height, I_TYPE, mpeg2dec_s::in_slice, mpeg2dec_s::is_frame_needed, mpeg2dec_s::is_sequence_needed, mpeg2dec_s::is_wait_for_ip_frames, libmpeg2_accel_frame_completion(), libmpeg2_accel_new_frame(), libmpeg2_accel_new_sequence(), libmpeg2_accel_slice(), lprintf, mpeg2_flush(), mpeg2_header_extension(), mpeg2_header_group_of_pictures(), mpeg2_header_picture(), mpeg2_header_sequence(), mpeg2_stats(), mpeg2dec_s::new_sequence, NULL, P_TYPE, xine_format_change_data_t::pan_scan, mpeg2dec_s::picture, process_userdata(), picture_t::progressive_frame, mpeg2dec_s::pts, remember_metainfo(), picture_t::repeat_first_field, mpeg2dec_s::stream, picture_t::top_field_first, xine_stream_s::video_out, VO_INTERLACED_FLAG, VO_NEW_SEQUENCE_FLAG, VO_PAN_SCAN_FLAG, xine_format_change_data_t::width, XINE_EVENT_FRAME_FORMAT_CHANGE, xine_event_send(), XINE_PICT_B_TYPE, XINE_PICT_D_TYPE, XINE_PICT_I_TYPE, XINE_PICT_P_TYPE, XINE_STREAM_INFO_VIDEO_AFD, XINE_STREAM_INFO_VIDEO_HEIGHT, XINE_STREAM_INFO_VIDEO_WIDTH, and XINE_VIDEO_AFD_NOT_PRESENT.

Referenced by mpeg2_decode_data().

## ◆ process_userdata()

static void process_userdata | ( | mpeg2dec_t * | mpeg2dec,
|  | uint8_t * | buffer
| ) |  |
| static

References _x_get_spu_decoder(), _x_stream_info_set(), mpeg2dec_s::afd_value_seen, xine_format_change_data_t::aspect, picture_s::aspect_ratio_information, BUF_SPU_CC, mpeg2dec_s::cc_dec, picture_s::coded_picture_height, picture_s::coded_picture_width, buf_element_s::content, spu_decoder_s::decode_data, buf_element_s::decoder_flags, picture_s::display_height, picture_s::display_width, find_end(), mpeg2dec_s::force_pan_scan, xine_format_change_data_t::height, xine_format_change_data_t::pan_scan, mpeg2dec_s::picture, buf_element_s::pts, mpeg2dec_s::pts, buf_element_s::size, mpeg2dec_s::stream, buf_element_s::type, xine_format_change_data_t::width, XINE_EVENT_FRAME_FORMAT_CHANGE, xine_event_send(), XINE_STREAM_INFO_VIDEO_HEIGHT, XINE_STREAM_INFO_VIDEO_WIDTH, and XINE_VIDEO_AFD_NOT_PRESENT.

Referenced by parse_chunk().

## ◆ remember_metainfo()

static void remember_metainfo | ( | mpeg2dec_t * | mpeg2dec | ) |
| static

References _x_meta_info_set_utf8(), _x_stream_info_set(), picture_s::frame_rate_code, get_aspect_ratio(), mpeg2dec_s::picture, mpeg2dec_s::stream, XINE_META_INFO_VIDEOCODEC, XINE_STREAM_INFO_FRAME_DURATION, XINE_STREAM_INFO_VIDEO_HEIGHT, XINE_STREAM_INFO_VIDEO_RATIO, and XINE_STREAM_INFO_VIDEO_WIDTH.

Referenced by mpeg2_find_sequence_header(), and parse_chunk().