xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Functions
video_out.c File Reference
#include <signal.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <inttypes.h>
#include <errno.h>
#include <xine/xine_internal.h>
#include <xine/video_out.h>
#include <xine/metronom.h>
#include <xine/xineutils.h>
#include <yuv2rgb.h>
#include "xine_private.h"

Data Structures

struct  vos_grab_video_frame_s
 
struct  vos_t
 

Macros

#define XINE_ENABLE_EXPERIMENTAL_FEATURES
 
#define LOG_MODULE   "video_out"
 
#define LOG_VERBOSE
 
#define NUM_FRAME_BUFFERS   15
 
#define DEFAULT_FRAME_DURATION   3000 /* 30 frames per second */
 
#define FIRST_FRAME_POLL_DELAY   3000
 
#define FIRST_FRAME_MAX_POLL   10 /* poll n times at most */
 
#define EXPERIMENTAL_FRAME_QUEUE_OPTIMIZATION   1
 
#define STREAMS_DEFAULT_SIZE   32
 
#define ADD_READY_FRAMES
 

Typedefs

typedef struct vos_grab_video_frame_s vos_grab_video_frame_t
 

Functions

static void vo_streams_open (vos_t *this)
 
static void vo_streams_close (vos_t *this)
 
static void vo_streams_register (vos_t *this, xine_stream_private_t *s)
 
static void vo_streams_unregister (vos_t *this, xine_stream_private_t *s)
 
static void vo_reref (vos_t *this, vo_frame_t *img)
 
static void vo_unref_list (vos_t *this, vo_frame_t *img)
 
static void vo_unref_obsolete (vos_t *this)
 
static void vo_free_queue_open (vos_t *this)
 
static void vo_display_queue_open (vos_t *this)
 
static void vo_free_queue_close (vos_t *this)
 
static void vo_display_queue_close (vos_t *this)
 
static vo_frame_tvo_free_queue_get_all (vos_t *this)
 
static vo_frame_tvo_display_queue_get_all (vos_t *this)
 
static void vo_dispose_list (vo_frame_t *list)
 
static void vo_free_queue_read_lock (vos_t *this)
 
static void vo_free_queue_read_unlock (vos_t *this)
 
static void vo_ticket_revoked (void *user_data, int flags)
 
static void vo_display_reref_append (vos_t *this, vo_frame_t *img)
 
static void vo_free_append (vos_t *this, vo_frame_t *img)
 
static void vo_free_append_list (vos_t *this, vo_frame_t *img, vo_frame_t **add, int n)
 
static vo_frame_tvo_free_queue_pop_int (vos_t *this)
 
static vo_frame_tvo_display_queue_pop_int (vos_t *this)
 
static int vo_frame_dec2_lock_int (vos_t *this, vo_frame_t *img)
 
static vo_frame_tvo_get_unblock_frame (vos_t *this)
 
static vo_frame_tvo_free_queue_get (vos_t *this, uint32_t width, uint32_t height, double ratio, int format, int flags)
 
static vo_frame_tvo_free_get_dupl (vos_t *this, vo_frame_t *s)
 
static void vo_update_max_frame_rate (vos_t *this, int speed)
 
static void vo_frame_inc2_lock (vo_frame_t *img)
 
static void vo_frame_inc_lock (vo_frame_t *img)
 
static void vo_frame_dec_lock (vo_frame_t *img)
 
static void vo_frame_dec2_lock (vos_t *this, vo_frame_t *img)
 
static void vo_wait_flush (vos_t *this)
 
static void vo_list_flush (vos_t *this, vo_frame_t *f)
 
static void vo_manual_flush (vos_t *this)
 
static void vo_dispose_grab_video_frame (xine_grab_video_frame_t *frame_gen)
 
static int vo_grab_grab_video_frame (xine_grab_video_frame_t *frame_gen)
 
static xine_grab_video_frame_tvo_new_grab_video_frame (xine_video_port_t *this_gen)
 
static void vo_grab_current_frame (vos_t *this, vo_frame_t *vo_frame, int64_t vpts)
 
static void vo_frame_driver_proc (vo_frame_t *img)
 
static vo_frame_tvo_get_frame (xine_video_port_t *this_gen, uint32_t width, uint32_t height, double ratio, int format, int flags)
 
static vo_frame_tcrop_frame (xine_video_port_t *this_gen, vo_frame_t *img)
 
static void vo_set_img_ei (vos_t *this, vo_frame_t *img)
 
static int vo_frame_draw (vo_frame_t *img, xine_stream_t *s)
 
static void vo_ready_refill (vos_t *this)
 
static vo_frame_tvo_ready_get_all (vos_t *this)
 
static vo_frame_tvo_ready_pop (vos_t *this)
 
static vo_frame_tvo_ready_get_dupl (vos_t *this, vo_frame_t *s)
 
static vo_frame_tduplicate_frame (vos_t *this, vo_frame_t *img, int locks)
 
static void check_redraw_needed (vos_t *this, int64_t vpts)
 
static vo_frame_tnext_frame (vos_t *this, int64_t *vpts)
 
static void overlay_and_display_frame (vos_t *this, vo_frame_t *img, int64_t vpts)
 
static void paused_loop (vos_t *this, int64_t vpts)
 
static void video_out_set_warn_skipped_threshold (void *this_gen, xine_cfg_entry_t *entry)
 
static void video_out_set_warn_discarded_threshold (void *this_gen, xine_cfg_entry_t *entry)
 
static void video_out_set_max_frame_rate (void *this_gen, xine_cfg_entry_t *entry)
 
static void video_out_update_disable_flush_from_video_out (void *this_gen, xine_cfg_entry_t *entry)
 
static void * video_out_loop (void *this_gen)
 
int xine_get_next_video_frame (xine_video_port_t *this_gen, xine_video_frame_t *frame)
 
void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame)
 
static uint32_t vo_get_capabilities (xine_video_port_t *this_gen)
 
static void vo_open (xine_video_port_t *this_gen, xine_stream_t *stream)
 
static void vo_close (xine_video_port_t *this_gen, xine_stream_t *stream)
 
static int vo_get_property (xine_video_port_t *this_gen, int property)
 
static int vo_set_property (xine_video_port_t *this_gen, int property, int value)
 
static int vo_status (xine_video_port_t *this_gen, xine_stream_t *s, int *width, int *height, int64_t *img_duration)
 
static void vo_speed_change_cb (void *this_gen, int new_speed)
 
static void vo_exit (xine_video_port_t *this_gen)
 
static vo_frame_tvo_get_last_frame (xine_video_port_t *this_gen)
 
static video_overlay_manager_tvo_get_overlay_manager (xine_video_port_t *this_gen)
 
static void vo_enable_overlay (xine_video_port_t *this_gen, int overlay_enabled)
 
static void vo_flush (xine_video_port_t *this_gen)
 
static void vo_trigger_drawing (xine_video_port_t *this_gen)
 
xine_video_port_t_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly)
 Build a video output port from a given video driver.
 

Macro Definition Documentation

◆ ADD_READY_FRAMES

#define ADD_READY_FRAMES
Value:
if (this->rp.ready_num < 2) { \
if (!this->rp.ready_num || this->display_queue.first) \
vo_ready_refill (this); \
}

Referenced by next_frame(), paused_loop(), and video_out_loop().

◆ DEFAULT_FRAME_DURATION

#define DEFAULT_FRAME_DURATION   3000 /* 30 frames per second */

Referenced by next_frame(), and vo_frame_draw().

◆ EXPERIMENTAL_FRAME_QUEUE_OPTIMIZATION

#define EXPERIMENTAL_FRAME_QUEUE_OPTIMIZATION   1

◆ FIRST_FRAME_MAX_POLL

#define FIRST_FRAME_MAX_POLL   10 /* poll n times at most */

Referenced by vo_frame_draw().

◆ FIRST_FRAME_POLL_DELAY

#define FIRST_FRAME_POLL_DELAY   3000

Referenced by next_frame().

◆ LOG_MODULE

#define LOG_MODULE   "video_out"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ NUM_FRAME_BUFFERS

#define NUM_FRAME_BUFFERS   15

Referenced by _x_vo_new_port().

◆ STREAMS_DEFAULT_SIZE

#define STREAMS_DEFAULT_SIZE   32

Referenced by vo_streams_open().

◆ XINE_ENABLE_EXPERIMENTAL_FEATURES

#define XINE_ENABLE_EXPERIMENTAL_FEATURES

Typedef Documentation

◆ vos_grab_video_frame_t

Function Documentation

◆ _x_vo_new_port()

xine_video_port_t * _x_vo_new_port ( xine_t * xine,
vo_driver_t * driver,
int grabonly )

◆ check_redraw_needed()

static void check_redraw_needed ( vos_t * this,
int64_t vpts )
static

Referenced by next_frame(), and paused_loop().

◆ crop_frame()

static vo_frame_t * crop_frame ( xine_video_port_t * this_gen,
vo_frame_t * img )
static

◆ duplicate_frame()

static vo_frame_t * duplicate_frame ( vos_t * this,
vo_frame_t * img,
int locks )
static

◆ next_frame()

static vo_frame_t * next_frame ( vos_t * this,
int64_t * vpts )
static

◆ overlay_and_display_frame()

static void overlay_and_display_frame ( vos_t * this,
vo_frame_t * img,
int64_t vpts )
static

◆ paused_loop()

static void paused_loop ( vos_t * this,
int64_t vpts )
static

◆ video_out_loop()

static void * video_out_loop ( void * this_gen)
static

◆ video_out_set_max_frame_rate()

static void video_out_set_max_frame_rate ( void * this_gen,
xine_cfg_entry_t * entry )
static

◆ video_out_set_warn_discarded_threshold()

static void video_out_set_warn_discarded_threshold ( void * this_gen,
xine_cfg_entry_t * entry )
static

References xine_cfg_entry_s::num_value.

Referenced by _x_vo_new_port().

◆ video_out_set_warn_skipped_threshold()

static void video_out_set_warn_skipped_threshold ( void * this_gen,
xine_cfg_entry_t * entry )
static

References xine_cfg_entry_s::num_value.

Referenced by _x_vo_new_port().

◆ video_out_update_disable_flush_from_video_out()

static void video_out_update_disable_flush_from_video_out ( void * this_gen,
xine_cfg_entry_t * entry )
static

References xine_cfg_entry_s::num_value.

Referenced by video_out_loop().

◆ vo_close()

static void vo_close ( xine_video_port_t * this_gen,
xine_stream_t * stream )
static

◆ vo_display_queue_close()

static void vo_display_queue_close ( vos_t * this)
static

References NULL.

Referenced by vo_exit().

◆ vo_display_queue_get_all()

static vo_frame_t * vo_display_queue_get_all ( vos_t * this)
static

References NULL.

Referenced by vo_exit().

◆ vo_display_queue_open()

static void vo_display_queue_open ( vos_t * this)
static

References NULL.

Referenced by _x_vo_new_port().

◆ vo_display_queue_pop_int()

static vo_frame_t * vo_display_queue_pop_int ( vos_t * this)
static

References vo_frame_s::next, and NULL.

Referenced by xine_get_next_video_frame().

◆ vo_display_reref_append()

static void vo_display_reref_append ( vos_t * this,
vo_frame_t * img )
static

◆ vo_dispose_grab_video_frame()

static void vo_dispose_grab_video_frame ( xine_grab_video_frame_t * frame_gen)
static

◆ vo_dispose_list()

static void vo_dispose_list ( vo_frame_t * list)
static

References vo_frame_s::dispose, vo_frame_s::next, and NULL.

Referenced by vo_exit().

◆ vo_enable_overlay()

static void vo_enable_overlay ( xine_video_port_t * this_gen,
int overlay_enabled )
static

References xine_rwlock_rdlock, and xine_rwlock_unlock.

Referenced by _x_vo_new_port().

◆ vo_exit()

static void vo_exit ( xine_video_port_t * this_gen)
static

◆ vo_flush()

static void vo_flush ( xine_video_port_t * this_gen)
static

References vo_manual_flush(), and vo_wait_flush().

Referenced by _x_vo_new_port().

◆ vo_frame_dec2_lock()

static void vo_frame_dec2_lock ( vos_t * this,
vo_frame_t * img )
static

◆ vo_frame_dec2_lock_int()

static int vo_frame_dec2_lock_int ( vos_t * this,
vo_frame_t * img )
static

◆ vo_frame_dec_lock()

static void vo_frame_dec_lock ( vo_frame_t * img)
static

◆ vo_frame_draw()

static int vo_frame_draw ( vo_frame_t * img,
xine_stream_t * s )
static

References _, _x_keyframes_add(), _x_stream_info_set(), vo_frame_s::bad_frame, vo_frame_s::crop_bottom, crop_frame(), vo_frame_s::crop_left, vo_frame_s::crop_right, vo_frame_s::crop_top, DEFAULT_FRAME_DURATION, xine_dropped_frames_t::discarded_frames, xine_dropped_frames_t::discarded_threshold, vo_frame_s::duration, vo_frame_s::extra_info, xine_stream_private_st::first_frame, FIRST_FRAME_MAX_POLL, xine_stream_private_st::flag, vo_frame_s::format, metronom_s::got_video_frame, vo_frame_s::height, INPUT_IS_SEEKABLE, extra_info_s::input_normpos, extra_info_s::input_time, vo_frame_s::is_first, xine_stream_private_st::lock, vo_frame_s::lock_counter, LOG_MODULE, lprintf, xine_stream_s::metronom, xine_keyframes_entry_t::msecs, xine_keyframes_entry_t::normpos, NULL, vo_frame_s::overlay_offset_x, vo_frame_s::overlay_offset_y, vo_frame_s::port, vo_frame_s::proc_called, vo_frame_s::pts, xine_stream_private_st::reached, xine_stream_private_st::s, xine_stream_private_st::side_streams, xine_dropped_frames_t::skipped_frames, xine_dropped_frames_t::skipped_threshold, vo_frame_s::stream, VO_CAP_CROP, vo_display_reref_append(), vo_frame_driver_proc(), vo_frame_inc2_lock(), vo_set_img_ei(), extra_info_s::vpts, vo_frame_s::vpts, vo_frame_s::width, XINE_ANON_STREAM, xine_current_extra_info_set(), XINE_EVENT_DROPPED_FRAMES, xine_event_send(), XINE_IMGFMT_YUY2, XINE_IMGFMT_YV12, xine_log(), XINE_LOG_MSG, xine_rwlock_rdlock, xine_rwlock_tryrdlock, xine_rwlock_unlock, XINE_STREAM_INFO_DISCARDED_FRAMES, XINE_STREAM_INFO_SKIPPED_FRAMES, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_vo_new_port().

◆ vo_frame_driver_proc()

static void vo_frame_driver_proc ( vo_frame_t * img)
static

◆ vo_frame_inc2_lock()

static void vo_frame_inc2_lock ( vo_frame_t * img)
static

◆ vo_frame_inc_lock()

static void vo_frame_inc_lock ( vo_frame_t * img)
static

◆ vo_free_append()

static void vo_free_append ( vos_t * this,
vo_frame_t * img )
static

◆ vo_free_append_list()

static void vo_free_append_list ( vos_t * this,
vo_frame_t * img,
vo_frame_t ** add,
int n )
static

Referenced by next_frame(), and vo_list_flush().

◆ vo_free_get_dupl()

static vo_frame_t * vo_free_get_dupl ( vos_t * this,
vo_frame_t * s )
static

◆ vo_free_queue_close()

static void vo_free_queue_close ( vos_t * this)
static

References NULL.

Referenced by vo_exit().

◆ vo_free_queue_get()

static vo_frame_t * vo_free_queue_get ( vos_t * this,
uint32_t width,
uint32_t height,
double ratio,
int format,
int flags )
static

◆ vo_free_queue_get_all()

static vo_frame_t * vo_free_queue_get_all ( vos_t * this)
static

References NULL.

Referenced by vo_exit().

◆ vo_free_queue_open()

static void vo_free_queue_open ( vos_t * this)
static

References NULL.

Referenced by _x_vo_new_port().

◆ vo_free_queue_pop_int()

static vo_frame_t * vo_free_queue_pop_int ( vos_t * this)
static

References vo_frame_s::next, and NULL.

Referenced by vo_get_unblock_frame().

◆ vo_free_queue_read_lock()

static void vo_free_queue_read_lock ( vos_t * this)
static

Referenced by paused_loop().

◆ vo_free_queue_read_unlock()

static void vo_free_queue_read_unlock ( vos_t * this)
static

Referenced by paused_loop().

◆ vo_get_capabilities()

static uint32_t vo_get_capabilities ( xine_video_port_t * this_gen)
static

◆ vo_get_frame()

static vo_frame_t * vo_get_frame ( xine_video_port_t * this_gen,
uint32_t width,
uint32_t height,
double ratio,
int format,
int flags )
static

◆ vo_get_last_frame()

static vo_frame_t * vo_get_last_frame ( xine_video_port_t * this_gen)
static

References vo_frame_inc_lock().

Referenced by _x_vo_new_port().

◆ vo_get_overlay_manager()

static video_overlay_manager_t * vo_get_overlay_manager ( xine_video_port_t * this_gen)
static

Referenced by _x_vo_new_port().

◆ vo_get_property()

static int vo_get_property ( xine_video_port_t * this_gen,
int property )
static

◆ vo_get_unblock_frame()

static vo_frame_t * vo_get_unblock_frame ( vos_t * this)
static

◆ vo_grab_current_frame()

static void vo_grab_current_frame ( vos_t * this,
vo_frame_t * vo_frame,
int64_t vpts )
static

◆ vo_grab_grab_video_frame()

static int vo_grab_grab_video_frame ( xine_grab_video_frame_t * frame_gen)
static

References _x_freep(), vo_frame_s::base, yuv2rgb_s::configure, yuv2rgb_factory_s::create_converter, xine_grab_video_frame_s::crop_bottom, vo_frame_s::crop_bottom, xine_grab_video_frame_s::crop_left, vo_frame_s::crop_left, xine_grab_video_frame_s::crop_right, vo_frame_s::crop_right, xine_grab_video_frame_s::crop_top, vo_frame_s::crop_top, vos_grab_video_frame_s::finished, xine_grab_video_frame_s::flags, vo_frame_s::flags, xine_current_frame_data_s::format, vo_frame_s::format, vos_grab_video_frame_s::grab_frame, vos_grab_video_frame_s::grab_height, vos_grab_video_frame_s::grab_width, xine_grab_video_frame_s::height, vo_frame_s::height, height, xine_current_frame_data_s::img, xine_grab_video_frame_s::img, vos_grab_video_frame_s::img, xine_current_frame_data_s::img_size, vos_grab_video_frame_s::img_size, MODE_24_RGB, vos_grab_video_frame_s::next, NULL, vo_frame_s::pitches, vo_frame_s::proc_provide_standard_frame_data, vo_frame_s::ratio, yuv2rgb_factory_s::set_csc_levels, xine_grab_video_frame_s::timeout, vos_grab_video_frame_s::uv_stride, vos_grab_video_frame_s::video_port, vos_grab_video_frame_s::vo_frame, vo_frame_dec_lock(), vo_frame_inc_lock(), VO_GET_FLAGS_CM, vos_grab_video_frame_s::vo_height, vos_grab_video_frame_s::vo_width, xine_grab_video_frame_s::vpts, vo_frame_s::vpts, xine_grab_video_frame_s::width, vo_frame_s::width, width, xine_gettime(), XINE_GRAB_VIDEO_FRAME_FLAGS_WAIT_NEXT, XINE_IMGFMT_YUY2, XINE_IMGFMT_YV12, vos_grab_video_frame_s::y_stride, vos_grab_video_frame_s::yuv2rgb, vos_grab_video_frame_s::yuv2rgb_factory, yuv2rgb_factory_init(), yuv2rgb_s::yuv2rgb_fun, and yuv2rgb_s::yuy22rgb_fun.

Referenced by vo_new_grab_video_frame().

◆ vo_list_flush()

static void vo_list_flush ( vos_t * this,
vo_frame_t * f )
static

◆ vo_manual_flush()

static void vo_manual_flush ( vos_t * this)
static

References NULL, and vo_list_flush().

Referenced by vo_flush(), and vo_set_property().

◆ vo_new_grab_video_frame()

static xine_grab_video_frame_t * vo_new_grab_video_frame ( xine_video_port_t * this_gen)
static

◆ vo_open()

static void vo_open ( xine_video_port_t * this_gen,
xine_stream_t * stream )
static

◆ vo_ready_get_all()

static vo_frame_t * vo_ready_get_all ( vos_t * this)
static

References NULL.

Referenced by next_frame(), paused_loop(), and video_out_loop().

◆ vo_ready_get_dupl()

static vo_frame_t * vo_ready_get_dupl ( vos_t * this,
vo_frame_t * s )
static

◆ vo_ready_pop()

static vo_frame_t * vo_ready_pop ( vos_t * this)
static

References vo_frame_s::next, and NULL.

Referenced by next_frame(), and paused_loop().

◆ vo_ready_refill()

static void vo_ready_refill ( vos_t * this)
static

References NULL.

Referenced by duplicate_frame().

◆ vo_reref()

static void vo_reref ( vos_t * this,
vo_frame_t * img )
static

◆ vo_set_img_ei()

static void vo_set_img_ei ( vos_t * this,
vo_frame_t * img )
static

◆ vo_set_property()

static int vo_set_property ( xine_video_port_t * this_gen,
int property,
int value )
static

◆ vo_speed_change_cb()

static void vo_speed_change_cb ( void * this_gen,
int new_speed )
static

◆ vo_status()

static int vo_status ( xine_video_port_t * this_gen,
xine_stream_t * s,
int * width,
int * height,
int64_t * img_duration )
static

◆ vo_streams_close()

static void vo_streams_close ( vos_t * this)
static

References NULL, and xine_rwlock_destroy.

Referenced by vo_exit().

◆ vo_streams_open()

static void vo_streams_open ( vos_t * this)
static

◆ vo_streams_register()

static void vo_streams_register ( vos_t * this,
xine_stream_private_t * s )
static

◆ vo_streams_unregister()

static void vo_streams_unregister ( vos_t * this,
xine_stream_private_t * s )
static

◆ vo_ticket_revoked()

static void vo_ticket_revoked ( void * user_data,
int flags )
static

◆ vo_trigger_drawing()

static void vo_trigger_drawing ( xine_video_port_t * this_gen)
static

Referenced by _x_vo_new_port().

◆ vo_unref_list()

static void vo_unref_list ( vos_t * this,
vo_frame_t * img )
static

◆ vo_unref_obsolete()

static void vo_unref_obsolete ( vos_t * this)
static

◆ vo_update_max_frame_rate()

static void vo_update_max_frame_rate ( vos_t * this,
int speed )
static

◆ vo_wait_flush()

static void vo_wait_flush ( vos_t * this)
static

Referenced by vo_flush(), and vo_set_property().

◆ xine_free_video_frame()

void xine_free_video_frame ( xine_video_port_t * port,
xine_video_frame_t * frame )

◆ xine_get_next_video_frame()

int xine_get_next_video_frame ( xine_video_port_t * this_gen,
xine_video_frame_t * frame )