input_internal.h
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:7k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * input_internal.h: Internal input structures
  3.  *****************************************************************************
  4.  * Copyright (C) 1998-2006 the VideoLAN team
  5.  * $Id: 2725f6bdc9d109611a14dddea2f499eac972af7a $
  6.  *
  7.  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  22.  *****************************************************************************/
  23. #if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
  24. # error This header file can only be included from LibVLC.
  25. #endif
  26. #ifndef _INPUT_INTERNAL_H
  27. #define _INPUT_INTERNAL_H 1
  28. #include <vlc_access.h>
  29. #include <vlc_demux.h>
  30. #include <vlc_input.h>
  31. #include <libvlc.h>
  32. #include "input_interface.h"
  33. /*****************************************************************************
  34.  *  Private input fields
  35.  *****************************************************************************/
  36. #define INPUT_CONTROL_FIFO_SIZE    100
  37. /* input_source_t: gathers all information per input source */
  38. typedef struct
  39. {
  40.     /* Access/Stream/Demux plugins */
  41.     access_t *p_access;
  42.     stream_t *p_stream;
  43.     demux_t  *p_demux;
  44.     /* Title infos for that input */
  45.     bool         b_title_demux; /* Titles/Seekpoints provided by demux */
  46.     int          i_title;
  47.     input_title_t **title;
  48.     int i_title_offset;
  49.     int i_seekpoint_offset;
  50.     int i_title_start;
  51.     int i_title_end;
  52.     int i_seekpoint_start;
  53.     int i_seekpoint_end;
  54.     /* Properties */
  55.     bool b_can_pause;
  56.     bool b_can_pace_control;
  57.     bool b_can_rate_control;
  58.     bool b_can_stream_record;
  59.     bool b_rescale_ts;
  60.     /* */
  61.     int64_t i_pts_delay;
  62.     bool       b_eof;   /* eof of demuxer */
  63. } input_source_t;
  64. typedef struct
  65. {
  66.     int         i_type;
  67.     vlc_value_t val;
  68. } input_control_t;
  69. /** Private input fields */
  70. struct input_thread_private_t
  71. {
  72.     /* Global properties */
  73.     bool        b_can_pause;
  74.     bool        b_can_rate_control;
  75.     bool        b_can_pace_control;
  76.     double      f_fps;
  77.     int         i_state;
  78.     /* Current state */
  79.     int         i_rate;
  80.     bool        b_recording;
  81.     /* Playtime configuration and state */
  82.     int64_t     i_start;    /* :start-time,0 by default */
  83.     int64_t     i_stop;     /* :stop-time, 0 if none */
  84.     int64_t     i_run;      /* :run-time, 0 if none */
  85.     int64_t     i_time;     /* Current time */
  86.     bool        b_fast_seek;/* :input-fast-seek */
  87.     /* Title infos FIXME multi-input (not easy) ? */
  88.     int          i_title;
  89.     input_title_t **title;
  90.     int i_title_offset;
  91.     int i_seekpoint_offset;
  92.     /* User bookmarks FIXME won't be easy with multiples input */
  93.     seekpoint_t bookmark;
  94.     int         i_bookmark;
  95.     seekpoint_t **pp_bookmark;
  96.     /* Input attachment */
  97.     int i_attachment;
  98.     input_attachment_t **attachment;
  99.     /* Output */
  100.     es_out_t        *p_es_out;
  101.     es_out_t        *p_es_out_display;
  102.     sout_instance_t *p_sout;            /* XXX Move it to es_out ? */
  103.     bool            b_out_pace_control; /*     idem ? */
  104.     /* Main input properties */
  105.     /* Input item */
  106.     input_item_t   *p_item;
  107.     /* Main source */
  108.     input_source_t input;
  109.     /* Slave sources (subs, and others) */
  110.     int            i_slave;
  111.     input_source_t **slave;
  112.     /* Resources */
  113.     input_resource_t *p_resource;
  114.     /* Stats counters */
  115.     struct {
  116.         counter_t *p_read_packets;
  117.         counter_t *p_read_bytes;
  118.         counter_t *p_input_bitrate;
  119.         counter_t *p_demux_read;
  120.         counter_t *p_demux_bitrate;
  121.         counter_t *p_demux_corrupted;
  122.         counter_t *p_demux_discontinuity;
  123.         counter_t *p_decoded_audio;
  124.         counter_t *p_decoded_video;
  125.         counter_t *p_decoded_sub;
  126.         counter_t *p_sout_sent_packets;
  127.         counter_t *p_sout_sent_bytes;
  128.         counter_t *p_sout_send_bitrate;
  129.         counter_t *p_played_abuffers;
  130.         counter_t *p_lost_abuffers;
  131.         counter_t *p_displayed_pictures;
  132.         counter_t *p_lost_pictures;
  133.         vlc_mutex_t counters_lock;
  134.     } counters;
  135.     /* Buffer of pending actions */
  136.     vlc_mutex_t lock_control;
  137.     vlc_cond_t  wait_control;
  138.     int i_control;
  139.     input_control_t control[INPUT_CONTROL_FIFO_SIZE];
  140.     bool b_abort;
  141. };
  142. /***************************************************************************
  143.  * Internal control helpers
  144.  ***************************************************************************/
  145. enum input_control_e
  146. {
  147.     INPUT_CONTROL_SET_DIE,
  148.     INPUT_CONTROL_SET_STATE,
  149.     INPUT_CONTROL_SET_RATE,
  150.     INPUT_CONTROL_SET_RATE_SLOWER,
  151.     INPUT_CONTROL_SET_RATE_FASTER,
  152.     INPUT_CONTROL_SET_POSITION,
  153.     INPUT_CONTROL_SET_POSITION_OFFSET,
  154.     INPUT_CONTROL_SET_TIME,
  155.     INPUT_CONTROL_SET_TIME_OFFSET,
  156.     INPUT_CONTROL_SET_PROGRAM,
  157.     INPUT_CONTROL_SET_TITLE,
  158.     INPUT_CONTROL_SET_TITLE_NEXT,
  159.     INPUT_CONTROL_SET_TITLE_PREV,
  160.     INPUT_CONTROL_SET_SEEKPOINT,
  161.     INPUT_CONTROL_SET_SEEKPOINT_NEXT,
  162.     INPUT_CONTROL_SET_SEEKPOINT_PREV,
  163.     INPUT_CONTROL_SET_BOOKMARK,
  164.     INPUT_CONTROL_SET_ES,
  165.     INPUT_CONTROL_RESTART_ES,
  166.     INPUT_CONTROL_SET_AUDIO_DELAY,
  167.     INPUT_CONTROL_SET_SPU_DELAY,
  168.     INPUT_CONTROL_ADD_SLAVE,
  169.     INPUT_CONTROL_ADD_SUBTITLE,
  170.     INPUT_CONTROL_SET_RECORD_STATE,
  171.     INPUT_CONTROL_SET_FRAME_NEXT,
  172. };
  173. /* Internal helpers */
  174. /* XXX for string value you have to allocate it before calling
  175.  * input_ControlPush
  176.  */
  177. void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
  178. /**********************************************************************
  179.  * Item metadata
  180.  **********************************************************************/
  181. /* input_ExtractAttachmentAndCacheArt:
  182.  *  Becarefull; p_item lock HAS to be taken */
  183. void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input );
  184. /***************************************************************************
  185.  * Internal prototypes
  186.  ***************************************************************************/
  187. /* var.c */
  188. void input_ControlVarInit ( input_thread_t * );
  189. void input_ControlVarStop( input_thread_t * );
  190. void input_ControlVarNavigation( input_thread_t * );
  191. void input_ControlVarTitle( input_thread_t *, int i_title );
  192. void input_ConfigVarInit ( input_thread_t * );
  193. /* Subtitles */
  194. char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
  195. int subtitles_Filter( const char *);
  196. #endif