]> git.sesse.net Git - vlc/blob - modules/stream_out/transcode/transcode.h
09769c19599acc9c5c62ee008de5f4fe1a4f81f2
[vlc] / modules / stream_out / transcode / transcode.h
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #include <vlc_common.h>
6
7 #include <vlc_sout.h>
8 #include <vlc_filter.h>
9 #include <vlc_es.h>
10 #include <vlc_codec.h>
11
12 #include <vlc_picture_fifo.h>
13
14 /*100ms is around the limit where people are noticing lipsync issues*/
15 #define MASTER_SYNC_MAX_DRIFT 100000
16
17 struct sout_stream_sys_t
18 {
19     sout_stream_id_t *id_video;
20     block_t         *p_buffers;
21     vlc_mutex_t     lock_out;
22     vlc_cond_t      cond;
23     bool            b_abort;
24     picture_fifo_t *pp_pics;
25     vlc_thread_t    thread;
26
27     /* Audio */
28     vlc_fourcc_t    i_acodec;   /* codec audio (0 if not transcode) */
29     audio_sample_format_t   fmt_audio;
30     char            *psz_aenc;
31     char            *psz_alang;
32     config_chain_t  *p_audio_cfg;
33     uint32_t        i_sample_rate;
34     uint32_t        i_channels;
35     int             i_abitrate;
36
37     char            *psz_af;
38
39     /* Video */
40     vlc_fourcc_t    i_vcodec;   /* codec video (0 if not transcode) */
41     video_format_t  fmt_input_video;
42     char            *psz_venc;
43     config_chain_t  *p_video_cfg;
44     int             i_vbitrate;
45     double          f_scale;
46     double          f_fps;
47     unsigned int    i_width, i_maxwidth;
48     unsigned int    i_height, i_maxheight;
49     bool            b_deinterlace;
50     char            *psz_deinterlace;
51     config_chain_t  *p_deinterlace_cfg;
52     int             i_threads;
53     bool            b_high_priority;
54     bool            b_hurry_up;
55
56     char            *psz_vf2;
57
58     /* SPU */
59     vlc_fourcc_t    i_scodec;   /* codec spu (0 if not transcode) */
60     char            *psz_senc;
61     bool            b_soverlay;
62     config_chain_t  *p_spu_cfg;
63     spu_t           *p_spu;
64     filter_t        *p_spu_blend;
65
66     /* OSD Menu */
67     vlc_fourcc_t    i_osdcodec; /* codec osd menu (0 if not transcode) */
68     char            *psz_osdenc;
69     config_chain_t  *p_osd_cfg;
70     bool            b_osd;   /* true when osd es is registered */
71
72     /* Sync */
73     bool            b_master_sync;
74     mtime_t         i_master_drift;
75 };
76
77 struct aout_filters;
78
79 struct sout_stream_id_t
80 {
81     bool            b_transcode;
82
83     /* id of the out stream */
84     void *id;
85
86     /* Decoder */
87     decoder_t       *p_decoder;
88
89     union
90     {
91          struct
92          {
93              filter_chain_t  *p_f_chain; /**< Video filters */
94              filter_chain_t  *p_uf_chain; /**< User-specified video filters */
95          };
96          struct aout_filters *p_af_chain; /**< Audio filters */
97     };
98
99     /* Encoder */
100     encoder_t       *p_encoder;
101
102     /* Sync */
103     date_t          interpolated_pts; /**< Incoming calculated PTS */
104     date_t          next_output_pts; /**< output calculated PTS */
105     int             i_output_frame_interval;
106     int             i_input_frame_interval;
107 };
108
109 /* OSD */
110
111 int transcode_osd_new( sout_stream_t *p_stream, sout_stream_id_t *id );
112 void transcode_osd_close( sout_stream_t *p_stream, sout_stream_id_t *id);
113 int transcode_osd_process( sout_stream_t *p_stream, sout_stream_id_t *id,
114                                   block_t *in, block_t **out );
115 bool transcode_osd_add    ( sout_stream_t *, es_format_t *, sout_stream_id_t *);
116
117 /* SPU */
118
119 int  transcode_spu_new    ( sout_stream_t *, sout_stream_id_t * );
120 void transcode_spu_close  ( sout_stream_t *, sout_stream_id_t * );
121 int  transcode_spu_process( sout_stream_t *, sout_stream_id_t *,
122                                    block_t *, block_t ** );
123 bool transcode_spu_add    ( sout_stream_t *, es_format_t *, sout_stream_id_t *);
124
125 /* AUDIO */
126
127 int  transcode_audio_new    ( sout_stream_t *, sout_stream_id_t * );
128 void transcode_audio_close  ( sout_stream_id_t * );
129 int  transcode_audio_process( sout_stream_t *, sout_stream_id_t *,
130                                      block_t *, block_t ** );
131 bool transcode_audio_add    ( sout_stream_t *, es_format_t *,
132                                 sout_stream_id_t *);
133
134 /* VIDEO */
135
136 int  transcode_video_new    ( sout_stream_t *, sout_stream_id_t * );
137 void transcode_video_close  ( sout_stream_t *, sout_stream_id_t * );
138 int  transcode_video_process( sout_stream_t *, sout_stream_id_t *,
139                                      block_t *, block_t ** );
140 bool transcode_video_add    ( sout_stream_t *, es_format_t *,
141                                 sout_stream_id_t *);