{"id":303906,"date":"2020-05-20T09:00:34","date_gmt":"2020-05-20T09:00:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303906"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303906","title":{"rendered":"[\u0427\u0430\u0441\u0442\u044c 2\/2] \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e FFmpeg \u0438 SDL \u0438\u043b\u0438 \u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043f\u043b\u0435\u0435\u0440 \u043c\u0435\u043d\u0435\u0435 \u0447\u0435\u043c \u0432 1000 \u0441\u0442\u0440\u043e\u043a"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/\"><\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"325\" src=\"https:\/\/habrastorage.org\/webt\/yx\/qh\/nq\/yxqhnqwvdlvzfw22erhmpfzpfba.png\"><\/div>\n<p><\/a><br \/>  \u0412\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0433\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0432\u0448\u0435\u0433\u043e \u0441\u0432\u043e\u0435\u0439 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e\u0442 \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u00ab\u043a\u0443\u0445\u043d\u044e\u00bb \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a FFmpeg \u0438 SDL.<\/p>\n<p>  \u0418 \u0445\u043e\u0442\u044f \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c, \u0432 \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u044b <i>\u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430<\/i>. \u0421\u043e\u043e\u0431\u0449\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u0445 (\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445) \u2014 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<a name=\"menu\"><\/a><\/p>\n<h3>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h3>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th align=\"center\"><a href=\"https:\/\/habr.com\/ru\/post\/500402\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a><\/th>\n<th align=\"center\">\u0427\u0430\u0441\u0442\u044c 2<\/th>\n<\/tr>\n<tr>\n<td align=\"left\">\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<br \/>  \u0423\u0440\u043e\u043a 1: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u043f\u0441\u043e\u0432<br \/>  \u0423\u0440\u043e\u043a 2: \u0412\u044b\u0432\u043e\u0434 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<br \/>  \u0423\u0440\u043e\u043a 3: \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0437\u0432\u0443\u043a\u0430<br \/>  \u0423\u0440\u043e\u043a 4: \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0434\u044b<br \/>  \u0423\u0440\u043e\u043a 5: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e  <\/td>\n<td align=\"left\"><a href=\"https:\/\/habr.com\/ru\/post\/502844\/#audio\">\u0423\u0440\u043e\u043a 6: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#seeking\">\u0423\u0440\u043e\u043a 7: \u041f\u043e\u0438\u0441\u043a<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#epilogue\">\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#functions\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 1. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#data\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 2. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#links\">\u0421\u0441\u044b\u043b\u043a\u0438<\/a><\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><a name=\"habracut\"><\/a><br \/>  <a name=\"audio\"><\/a><\/p>\n<blockquote><p><a href=\"https:\/\/www.edsd.ru\/\" title=\"EDISON Software - web-development\"><img loading=\"lazy\" decoding=\"async\" align=\"left\" width=\"153\" height=\"75\" src=\"https:\/\/habrastorage.org\/webt\/w0\/zl\/to\/w0zltoxvysbr0yeinstkfvw1wbg.png\" alt=\"EDISON Software - web-development\"><\/a><br clear=\"right\">  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u0430 \u043f\u0440\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 EDISON.<\/p>\n<p>  \u0421\u0440\u0435\u0434\u0438 \u043d\u0430\u0448\u0438\u0445 \u0440\u0430\u0431\u043e\u0442 \u043c\u043d\u043e\u0433\u043e \u0442\u0430\u043a\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 <a href=\"https:\/\/www.edsd.ru\/oblachnyj-servis-videonablyudeniya-zodiak\">\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/a>, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 <a href=\"https:\/\/www.edsd.ru\/integratsiya-sistem-videonablyudeniya-axxon-next-i-sureview-immix\">\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f Axxon Next \u0438 SureView Immix<\/a>.<\/p>\n<p>  \u041c\u044b \u043b\u044e\u0431\u0438\u043c \u0438 \u0443\u043c\u0435\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0432\u0438\u0434\u0435\u043e! \ud83d\ude09<\/p><\/blockquote>\n<p>  <\/p>\n<h2>\u0423\u0440\u043e\u043a 6: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e <a href=\"https:\/\/habr.com\/ru\/post\/500402\/#video\" title=\"\u0423\u0440\u043e\u043a 5: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a> <a href=\"#seeking\" title=\"\u0423\u0440\u043e\u043a 7: \u041f\u043e\u0438\u0441\u043a\">\u2192<\/a><\/h2>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 tutorial06.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/ tutorial05.c \/\/ A pedagogical video player that really works! \/\/ \/\/ Code based on FFplay, Copyright (c) 2003 Fabrice Bellard,  \/\/ and a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de) \/\/ Tested on Gentoo, CVS version 5\/01\/07 compiled with GCC 4.1.1 \/\/ With updates from https:\/\/github.com\/chelyaev\/ffmpeg-tutorial \/\/ Updates tested on: \/\/ LAVC 54.59.100, LAVF 54.29.104, LSWS 2.1.101, SDL 1.2.15 \/\/ on GCC 4.7.2 in Debian February 2015 \/\/ Use \/\/ \/\/ gcc -o tutorial05 tutorial05.c -lavformat -lavcodec -lswscale -lz -lm `sdl-config --cflags --libs` \/\/ to build (assuming libavformat and libavcodec are correctly installed,  \/\/ and assuming you have sdl-config. Please refer to SDL docs for your installation.) \/\/ \/\/ Run using \/\/ tutorial04 myvideofile.mpg \/\/ \/\/ to play the video stream on your screen.  #include &lt;libavcodec\/avcodec.h&gt; #include &lt;libavformat\/avformat.h&gt; #include &lt;libswscale\/swscale.h&gt;  #include &lt;SDL.h&gt; #include &lt;SDL_thread.h&gt;  #ifdef __MINGW32__ #undef main \/* Prevents SDL from overriding main() *\/ #endif  #include &lt;stdio.h&gt; #include &lt;assert.h&gt; #include &lt;math.h&gt;  \/\/ compatibility with newer API #if LIBAVCODEC_VERSION_INT &lt; AV_VERSION_INT(55,28,1) #define av_frame_alloc avcodec_alloc_frame #define av_frame_free avcodec_free_frame #endif  #define SDL_AUDIO_BUFFER_SIZE 1024 #define MAX_AUDIO_FRAME_SIZE 192000  #define MAX_AUDIOQ_SIZE (5 * 16 * 1024) #define MAX_VIDEOQ_SIZE (5 * 256 * 1024)  #define AV_SYNC_THRESHOLD 0.01 #define AV_NOSYNC_THRESHOLD 10.0  #define SAMPLE_CORRECTION_PERCENT_MAX 10 #define AUDIO_DIFF_AVG_NB 20  #define FF_REFRESH_EVENT (SDL_USEREVENT) #define FF_QUIT_EVENT (SDL_USEREVENT + 1)  #define VIDEO_PICTURE_QUEUE_SIZE 1  #define DEFAULT_AV_SYNC_TYPE AV_SYNC_VIDEO_MASTER  typedef struct PacketQueue {   AVPacketList *first_pkt, *last_pkt;   int nb_packets;   int size;   SDL_mutex *mutex;   SDL_cond *cond; } PacketQueue;   typedef struct VideoPicture {   SDL_Overlay *bmp;   int width, height; \/* source height &amp; width *\/   int allocated;   double pts; } VideoPicture;  typedef struct VideoState {    AVFormatContext *pFormatCtx;   int             videoStream, audioStream;    int             av_sync_type;   double          external_clock; \/* external clock base *\/   int64_t         external_clock_time;    double          audio_clock;   AVStream        *audio_st;   AVCodecContext  *audio_ctx;   PacketQueue     audioq;   uint8_t         audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) \/ 2];   unsigned int    audio_buf_size;   unsigned int    audio_buf_index;   AVFrame         audio_frame;   AVPacket        audio_pkt;   uint8_t         *audio_pkt_data;   int             audio_pkt_size;   int             audio_hw_buf_size;   double          audio_diff_cum; \/* used for AV difference average computation *\/   double          audio_diff_avg_coef;   double          audio_diff_threshold;   int             audio_diff_avg_count;   double          frame_timer;   double          frame_last_pts;   double          frame_last_delay;   double          video_clock; \/\/\/&lt;pts of last decoded frame \/ predicted pts of next decoded frame   double          video_current_pts; \/\/\/&lt;current displayed pts (different from video_clock if frame fifos are used)   int64_t         video_current_pts_time;  \/\/\/&lt;time (av_gettime) at which we updated video_current_pts - used to have running video pts   AVStream        *video_st;   AVCodecContext  *video_ctx;   PacketQueue     videoq;   struct SwsContext *sws_ctx;    VideoPicture    pictq[VIDEO_PICTURE_QUEUE_SIZE];   int             pictq_size, pictq_rindex, pictq_windex;   SDL_mutex       *pictq_mutex;   SDL_cond        *pictq_cond;      SDL_Thread      *parse_tid;   SDL_Thread      *video_tid;    char            filename[1024];   int             quit; } VideoState;  enum {   AV_SYNC_AUDIO_MASTER,   AV_SYNC_VIDEO_MASTER,   AV_SYNC_EXTERNAL_MASTER, };  SDL_Surface     *screen; SDL_mutex       *screen_mutex;  \/* Since we only have one decoding thread, the Big Struct    can be global in case we need it. *\/ VideoState *global_video_state;  void packet_queue_init(PacketQueue *q) {   memset(q, 0, sizeof(PacketQueue));   q-&gt;mutex = SDL_CreateMutex();   q-&gt;cond = SDL_CreateCond(); } int packet_queue_put(PacketQueue *q, AVPacket *pkt) {    AVPacketList *pkt1;   if(av_dup_packet(pkt) &lt; 0) {     return -1;   }   pkt1 = av_malloc(sizeof(AVPacketList));   if (!pkt1)     return -1;   pkt1-&gt;pkt = *pkt;   pkt1-&gt;next = NULL;      SDL_LockMutex(q-&gt;mutex);    if (!q-&gt;last_pkt)     q-&gt;first_pkt = pkt1;   else     q-&gt;last_pkt-&gt;next = pkt1;   q-&gt;last_pkt = pkt1;   q-&gt;nb_packets++;   q-&gt;size += pkt1-&gt;pkt.size;   SDL_CondSignal(q-&gt;cond);      SDL_UnlockMutex(q-&gt;mutex);   return 0; } static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) {   AVPacketList *pkt1;   int ret;    SDL_LockMutex(q-&gt;mutex);      for(;;) {          if(global_video_state-&gt;quit) {       ret = -1;       break;     }      pkt1 = q-&gt;first_pkt;     if (pkt1) {       q-&gt;first_pkt = pkt1-&gt;next;       if (!q-&gt;first_pkt) \tq-&gt;last_pkt = NULL;       q-&gt;nb_packets--;       q-&gt;size -= pkt1-&gt;pkt.size;       *pkt = pkt1-&gt;pkt;       av_free(pkt1);       ret = 1;       break;     } else if (!block) {       ret = 0;       break;     } else {       SDL_CondWait(q-&gt;cond, q-&gt;mutex);     }   }   SDL_UnlockMutex(q-&gt;mutex);   return ret; }  double get_audio_clock(VideoState *is) {   double pts;   int hw_buf_size, bytes_per_sec, n;      pts = is-&gt;audio_clock; \/* maintained in the audio thread *\/   hw_buf_size = is-&gt;audio_buf_size - is-&gt;audio_buf_index;   bytes_per_sec = 0;   n = is-&gt;audio_ctx-&gt;channels * 2;   if(is-&gt;audio_st) {     bytes_per_sec = is-&gt;audio_ctx-&gt;sample_rate * n;   }   if(bytes_per_sec) {     pts -= (double)hw_buf_size \/ bytes_per_sec;   }   return pts; } double get_video_clock(VideoState *is) {   double delta;    delta = (av_gettime() - is-&gt;video_current_pts_time) \/ 1000000.0;   return is-&gt;video_current_pts + delta; } double get_external_clock(VideoState *is) {   return av_gettime() \/ 1000000.0; }  double get_master_clock(VideoState *is) {   if(is-&gt;av_sync_type == AV_SYNC_VIDEO_MASTER) {     return get_video_clock(is);   } else if(is-&gt;av_sync_type == AV_SYNC_AUDIO_MASTER) {     return get_audio_clock(is);   } else {     return get_external_clock(is);   } }   \/* Add or subtract samples to get a better sync, return new    audio buffer size *\/ int synchronize_audio(VideoState *is, short *samples, \t\t      int samples_size, double pts) {   int n;   double ref_clock;    n = 2 * is-&gt;audio_ctx-&gt;channels;      if(is-&gt;av_sync_type != AV_SYNC_AUDIO_MASTER) {     double diff, avg_diff;     int wanted_size, min_size, max_size \/*, nb_samples *\/;          ref_clock = get_master_clock(is);     diff = get_audio_clock(is) - ref_clock;      if(diff &lt; AV_NOSYNC_THRESHOLD) {       \/\/ accumulate the diffs       is-&gt;audio_diff_cum = diff + is-&gt;audio_diff_avg_coef \t* is-&gt;audio_diff_cum;       if(is-&gt;audio_diff_avg_count &lt; AUDIO_DIFF_AVG_NB) { \tis-&gt;audio_diff_avg_count++;       } else { \tavg_diff = is-&gt;audio_diff_cum * (1.0 - is-&gt;audio_diff_avg_coef); \tif(fabs(avg_diff) &gt;= is-&gt;audio_diff_threshold) { \t  wanted_size = samples_size + ((int)(diff * is-&gt;audio_ctx-&gt;sample_rate) * n); \t  min_size = samples_size * ((100 - SAMPLE_CORRECTION_PERCENT_MAX) \/ 100); \t  max_size = samples_size * ((100 + SAMPLE_CORRECTION_PERCENT_MAX) \/ 100); \t  if(wanted_size &lt; min_size) { \t    wanted_size = min_size; \t  } else if (wanted_size &gt; max_size) { \t    wanted_size = max_size; \t  } \t  if(wanted_size &lt; samples_size) { \t    \/* remove samples *\/ \t    samples_size = wanted_size; \t  } else if(wanted_size &gt; samples_size) { \t    uint8_t *samples_end, *q; \t    int nb;  \t    \/* add samples by copying final sample*\/ \t    nb = (samples_size - wanted_size); \t    samples_end = (uint8_t *)samples + samples_size - n; \t    q = samples_end + n; \t    while(nb &gt; 0) { \t      memcpy(q, samples_end, n); \t      q += n; \t      nb -= n; \t    } \t    samples_size = wanted_size; \t  } \t}       }     } else {       \/* difference is TOO big; reset diff stuff *\/       is-&gt;audio_diff_avg_count = 0;       is-&gt;audio_diff_cum = 0;     }   }   return samples_size; }  int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, double *pts_ptr) {    int len1, data_size = 0;   AVPacket *pkt = &amp;is-&gt;audio_pkt;   double pts;   int n;    for(;;) {     while(is-&gt;audio_pkt_size &gt; 0) {       int got_frame = 0;       len1 = avcodec_decode_audio4(is-&gt;audio_ctx, &amp;is-&gt;audio_frame, &amp;got_frame, pkt);       if(len1 &lt; 0) { \t\/* if error, skip frame *\/ \tis-&gt;audio_pkt_size = 0; \tbreak;       }       data_size = 0;       if(got_frame) { \tdata_size = av_samples_get_buffer_size(NULL,  \t\t\t\t\t       is-&gt;audio_ctx-&gt;channels, \t\t\t\t\t       is-&gt;audio_frame.nb_samples, \t\t\t\t\t       is-&gt;audio_ctx-&gt;sample_fmt, \t\t\t\t\t       1); \tassert(data_size &lt;= buf_size); \tmemcpy(audio_buf, is-&gt;audio_frame.data[0], data_size);       }       is-&gt;audio_pkt_data += len1;       is-&gt;audio_pkt_size -= len1;       if(data_size &lt;= 0) { \t\/* No data yet, get more frames *\/ \tcontinue;       }       pts = is-&gt;audio_clock;       *pts_ptr = pts;       n = 2 * is-&gt;audio_ctx-&gt;channels;       is-&gt;audio_clock += (double)data_size \/ \t(double)(n * is-&gt;audio_ctx-&gt;sample_rate);       \/* We have data, return it and come back for more later *\/       return data_size;     }     if(pkt-&gt;data)       av_free_packet(pkt);      if(is-&gt;quit) {       return -1;     }     \/* next packet *\/     if(packet_queue_get(&amp;is-&gt;audioq, pkt, 1) &lt; 0) {       return -1;     }     is-&gt;audio_pkt_data = pkt-&gt;data;     is-&gt;audio_pkt_size = pkt-&gt;size;     \/* if update, update the audio clock w\/pts *\/     if(pkt-&gt;pts != AV_NOPTS_VALUE) {       is-&gt;audio_clock = av_q2d(is-&gt;audio_st-&gt;time_base)*pkt-&gt;pts;     }   } }  void audio_callback(void *userdata, Uint8 *stream, int len) {    VideoState *is = (VideoState *)userdata;   int len1, audio_size;   double pts;    while(len &gt; 0) {     if(is-&gt;audio_buf_index &gt;= is-&gt;audio_buf_size) {       \/* We have already sent all our data; get more *\/       audio_size = audio_decode_frame(is, is-&gt;audio_buf, sizeof(is-&gt;audio_buf), &amp;pts);       if(audio_size &lt; 0) { \t\/* If error, output silence *\/ \tis-&gt;audio_buf_size = 1024; \tmemset(is-&gt;audio_buf, 0, is-&gt;audio_buf_size);       } else { \taudio_size = synchronize_audio(is, (int16_t *)is-&gt;audio_buf, \t\t\t\t       audio_size, pts); \tis-&gt;audio_buf_size = audio_size;       }       is-&gt;audio_buf_index = 0;     }     len1 = is-&gt;audio_buf_size - is-&gt;audio_buf_index;     if(len1 &gt; len)       len1 = len;     memcpy(stream, (uint8_t *)is-&gt;audio_buf + is-&gt;audio_buf_index, len1);     len -= len1;     stream += len1;     is-&gt;audio_buf_index += len1;   } }  static Uint32 sdl_refresh_timer_cb(Uint32 interval, void *opaque) {   SDL_Event event;   event.type = FF_REFRESH_EVENT;   event.user.data1 = opaque;   SDL_PushEvent(&amp;event);   return 0; \/* 0 means stop timer *\/ }  \/* schedule a video refresh in 'delay' ms *\/ static void schedule_refresh(VideoState *is, int delay) {   SDL_AddTimer(delay, sdl_refresh_timer_cb, is); }  void video_display(VideoState *is) {    SDL_Rect rect;   VideoPicture *vp;   float aspect_ratio;   int w, h, x, y;   int i;    vp = &amp;is-&gt;pictq[is-&gt;pictq_rindex];   if(vp-&gt;bmp) {     if(is-&gt;video_ctx-&gt;sample_aspect_ratio.num == 0) {       aspect_ratio = 0;     } else {       aspect_ratio = av_q2d(is-&gt;video_ctx-&gt;sample_aspect_ratio) * \tis-&gt;video_ctx-&gt;width \/ is-&gt;video_ctx-&gt;height;     }     if(aspect_ratio &lt;= 0.0) {       aspect_ratio = (float)is-&gt;video_ctx-&gt;width \/ \t(float)is-&gt;video_ctx-&gt;height;     }     h = screen-&gt;h;     w = ((int)rint(h * aspect_ratio)) &amp; -3;     if(w &gt; screen-&gt;w) {       w = screen-&gt;w;       h = ((int)rint(w \/ aspect_ratio)) &amp; -3;     }     x = (screen-&gt;w - w) \/ 2;     y = (screen-&gt;h - h) \/ 2;          rect.x = x;     rect.y = y;     rect.w = w;     rect.h = h;     SDL_LockMutex(screen_mutex);     SDL_DisplayYUVOverlay(vp-&gt;bmp, &amp;rect);     SDL_UnlockMutex(screen_mutex);   } }  void video_refresh_timer(void *userdata) {    VideoState *is = (VideoState *)userdata;   VideoPicture *vp;   double actual_delay, delay, sync_threshold, ref_clock, diff;      if(is-&gt;video_st) {     if(is-&gt;pictq_size == 0) {       schedule_refresh(is, 1);     } else {       vp = &amp;is-&gt;pictq[is-&gt;pictq_rindex];              is-&gt;video_current_pts = vp-&gt;pts;       is-&gt;video_current_pts_time = av_gettime();       delay = vp-&gt;pts - is-&gt;frame_last_pts; \/* the pts from last time *\/       if(delay &lt;= 0 || delay &gt;= 1.0) { \t\/* if incorrect delay, use previous one *\/ \tdelay = is-&gt;frame_last_delay;       }       \/* save for next time *\/       is-&gt;frame_last_delay = delay;       is-&gt;frame_last_pts = vp-&gt;pts;          \/* update delay to sync to audio if not master source *\/       if(is-&gt;av_sync_type != AV_SYNC_VIDEO_MASTER) { \tref_clock = get_master_clock(is); \tdiff = vp-&gt;pts - ref_clock; \t \t\/* Skip or repeat the frame. Take delay into account \t   FFPlay still doesn't &quot;know if this is the best guess.&quot; *\/ \tsync_threshold = (delay &gt; AV_SYNC_THRESHOLD) ? delay : AV_SYNC_THRESHOLD; \tif(fabs(diff) &lt; AV_NOSYNC_THRESHOLD) { \t  if(diff &lt;= -sync_threshold) { \t    delay = 0; \t  } else if(diff &gt;= sync_threshold) { \t    delay = 2 * delay; \t  } \t}       }       is-&gt;frame_timer += delay;       \/* computer the REAL delay *\/       actual_delay = is-&gt;frame_timer - (av_gettime() \/ 1000000.0);       if(actual_delay &lt; 0.010) { \t\/* Really it should skip the picture instead *\/ \tactual_delay = 0.010;       }       schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));              \/* show the picture! *\/       video_display(is);              \/* update queue for next picture! *\/       if(++is-&gt;pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) { \tis-&gt;pictq_rindex = 0;       }       SDL_LockMutex(is-&gt;pictq_mutex);       is-&gt;pictq_size--;       SDL_CondSignal(is-&gt;pictq_cond);       SDL_UnlockMutex(is-&gt;pictq_mutex);     }   } else {     schedule_refresh(is, 100);   } }        void alloc_picture(void *userdata) {    VideoState *is = (VideoState *)userdata;   VideoPicture *vp;    vp = &amp;is-&gt;pictq[is-&gt;pictq_windex];   if(vp-&gt;bmp) {     \/\/ we already have one make another, bigger\/smaller     SDL_FreeYUVOverlay(vp-&gt;bmp);   }   \/\/ Allocate a place to put our YUV image on that screen   SDL_LockMutex(screen_mutex);   vp-&gt;bmp = SDL_CreateYUVOverlay(is-&gt;video_ctx-&gt;width, \t\t\t\t is-&gt;video_ctx-&gt;height, \t\t\t\t SDL_YV12_OVERLAY, \t\t\t\t screen);   SDL_UnlockMutex(screen_mutex);    vp-&gt;width = is-&gt;video_ctx-&gt;width;   vp-&gt;height = is-&gt;video_ctx-&gt;height;   vp-&gt;allocated = 1;  }  int queue_picture(VideoState *is, AVFrame *pFrame, double pts) {    VideoPicture *vp;   int dst_pix_fmt;   AVPicture pict;    \/* wait until we have space for a new pic *\/   SDL_LockMutex(is-&gt;pictq_mutex);   while(is-&gt;pictq_size &gt;= VIDEO_PICTURE_QUEUE_SIZE &amp;&amp; \t!is-&gt;quit) {     SDL_CondWait(is-&gt;pictq_cond, is-&gt;pictq_mutex);   }   SDL_UnlockMutex(is-&gt;pictq_mutex);    if(is-&gt;quit)     return -1;    \/\/ windex is set to 0 initially   vp = &amp;is-&gt;pictq[is-&gt;pictq_windex];    \/* allocate or resize the buffer! *\/   if(!vp-&gt;bmp ||      vp-&gt;width != is-&gt;video_ctx-&gt;width ||      vp-&gt;height != is-&gt;video_ctx-&gt;height) {     SDL_Event event;      vp-&gt;allocated = 0;     alloc_picture(is);     if(is-&gt;quit) {       return -1;     }   }    \/* We have a place to put our picture on the queue *\/    if(vp-&gt;bmp) {      SDL_LockYUVOverlay(vp-&gt;bmp);     vp-&gt;pts = pts;          dst_pix_fmt = PIX_FMT_YUV420P;     \/* point pict at the queue *\/      pict.data[0] = vp-&gt;bmp-&gt;pixels[0];     pict.data[1] = vp-&gt;bmp-&gt;pixels[2];     pict.data[2] = vp-&gt;bmp-&gt;pixels[1];          pict.linesize[0] = vp-&gt;bmp-&gt;pitches[0];     pict.linesize[1] = vp-&gt;bmp-&gt;pitches[2];     pict.linesize[2] = vp-&gt;bmp-&gt;pitches[1];          \/\/ Convert the image into YUV format that SDL uses     sws_scale(is-&gt;sws_ctx, (uint8_t const * const *)pFrame-&gt;data, \t      pFrame-&gt;linesize, 0, is-&gt;video_ctx-&gt;height, \t      pict.data, pict.linesize);          SDL_UnlockYUVOverlay(vp-&gt;bmp);     \/* now we inform our display thread that we have a pic ready *\/     if(++is-&gt;pictq_windex == VIDEO_PICTURE_QUEUE_SIZE) {       is-&gt;pictq_windex = 0;     }     SDL_LockMutex(is-&gt;pictq_mutex);     is-&gt;pictq_size++;     SDL_UnlockMutex(is-&gt;pictq_mutex);   }   return 0; }  double synchronize_video(VideoState *is, AVFrame *src_frame, double pts) {    double frame_delay;    if(pts != 0) {     \/* if we have pts, set video clock to it *\/     is-&gt;video_clock = pts;   } else {     \/* if we aren't given a pts, set it to the clock *\/     pts = is-&gt;video_clock;   }   \/* update the video clock *\/   frame_delay = av_q2d(is-&gt;video_ctx-&gt;time_base);   \/* if we are repeating a frame, adjust clock accordingly *\/   frame_delay += src_frame-&gt;repeat_pict * (frame_delay * 0.5);   is-&gt;video_clock += frame_delay;   return pts; }  int video_thread(void *arg) {   VideoState *is = (VideoState *)arg;   AVPacket pkt1, *packet = &amp;pkt1;   int frameFinished;   AVFrame *pFrame;   double pts;    pFrame = av_frame_alloc();    for(;;) {     if(packet_queue_get(&amp;is-&gt;videoq, packet, 1) &lt; 0) {       \/\/ means we quit getting packets       break;     }     if(packet_queue_get(&amp;is-&gt;videoq, packet, 1) &lt; 0) {       \/\/ means we quit getting packets       break;     }     pts = 0;      \/\/ Decode video frame     avcodec_decode_video2(is-&gt;video_ctx, pFrame, &amp;frameFinished, packet);      if((pts = av_frame_get_best_effort_timestamp(pFrame)) == AV_NOPTS_VALUE) {     } else {       pts = 0;     }     pts *= av_q2d(is-&gt;video_st-&gt;time_base);      \/\/ Did we get a video frame?     if(frameFinished) {       pts = synchronize_video(is, pFrame, pts);       if(queue_picture(is, pFrame, pts) &lt; 0) { \tbreak;       }     }     av_free_packet(packet);   }   av_frame_free(&amp;pFrame);   return 0; }  int stream_component_open(VideoState *is, int stream_index) {    AVFormatContext *pFormatCtx = is-&gt;pFormatCtx;   AVCodecContext *codecCtx = NULL;   AVCodec *codec = NULL;   SDL_AudioSpec wanted_spec, spec;    if(stream_index &lt; 0 || stream_index &gt;= pFormatCtx-&gt;nb_streams) {     return -1;   }    codec = avcodec_find_decoder(pFormatCtx-&gt;streams[stream_index]-&gt;codec-&gt;codec_id);   if(!codec) {     fprintf(stderr, &quot;Unsupported codec!\\n&quot;);     return -1;   }    codecCtx = avcodec_alloc_context3(codec);   if(avcodec_copy_context(codecCtx, pFormatCtx-&gt;streams[stream_index]-&gt;codec) != 0) {     fprintf(stderr, &quot;Couldn't copy codec context&quot;);     return -1; \/\/ Error copying codec context   }     if(codecCtx-&gt;codec_type == AVMEDIA_TYPE_AUDIO) {     \/\/ Set audio settings from codec info     wanted_spec.freq = codecCtx-&gt;sample_rate;     wanted_spec.format = AUDIO_S16SYS;     wanted_spec.channels = codecCtx-&gt;channels;     wanted_spec.silence = 0;     wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;     wanted_spec.callback = audio_callback;     wanted_spec.userdata = is;          if(SDL_OpenAudio(&amp;wanted_spec, &amp;spec) &lt; 0) {       fprintf(stderr, &quot;SDL_OpenAudio: %s\\n&quot;, SDL_GetError());       return -1;     }     is-&gt;audio_hw_buf_size = spec.size;   }   if(avcodec_open2(codecCtx, codec, NULL) &lt; 0) {     fprintf(stderr, &quot;Unsupported codec!\\n&quot;);     return -1;   }    switch(codecCtx-&gt;codec_type) {   case AVMEDIA_TYPE_AUDIO:     is-&gt;audioStream = stream_index;     is-&gt;audio_st = pFormatCtx-&gt;streams[stream_index];     is-&gt;audio_ctx = codecCtx;     is-&gt;audio_buf_size = 0;     is-&gt;audio_buf_index = 0;     memset(&amp;is-&gt;audio_pkt, 0, sizeof(is-&gt;audio_pkt));     packet_queue_init(&amp;is-&gt;audioq);     SDL_PauseAudio(0);     break;   case AVMEDIA_TYPE_VIDEO:     is-&gt;videoStream = stream_index;     is-&gt;video_st = pFormatCtx-&gt;streams[stream_index];     is-&gt;video_ctx = codecCtx;      is-&gt;frame_timer = (double)av_gettime() \/ 1000000.0;     is-&gt;frame_last_delay = 40e-3;     is-&gt;video_current_pts_time = av_gettime();      packet_queue_init(&amp;is-&gt;videoq);     is-&gt;video_tid = SDL_CreateThread(video_thread, is);     is-&gt;sws_ctx = sws_getContext(is-&gt;video_ctx-&gt;width, is-&gt;video_ctx-&gt;height, \t\t\t\t is-&gt;video_ctx-&gt;pix_fmt, is-&gt;video_ctx-&gt;width, \t\t\t\t is-&gt;video_ctx-&gt;height, PIX_FMT_YUV420P, \t\t\t\t SWS_BILINEAR, NULL, NULL, NULL \t\t\t\t );     break;   default:     break;   } }  int decode_thread(void *arg) {    VideoState *is = (VideoState *)arg;   AVFormatContext *pFormatCtx;   AVPacket pkt1, *packet = &amp;pkt1;    int video_index = -1;   int audio_index = -1;   int i;    is-&gt;videoStream=-1;   is-&gt;audioStream=-1;    global_video_state = is;    \/\/ Open video file   if(avformat_open_input(&amp;pFormatCtx, is-&gt;filename, NULL, NULL)!=0)     return -1; \/\/ Couldn't open file    is-&gt;pFormatCtx = pFormatCtx;      \/\/ Retrieve stream information   if(avformat_find_stream_info(pFormatCtx, NULL)&lt;0)     return -1; \/\/ Couldn't find stream information      \/\/ Dump information about file onto standard error   av_dump_format(pFormatCtx, 0, is-&gt;filename, 0);      \/\/ Find the first video stream    for(i=0; i&lt;pFormatCtx-&gt;nb_streams; i++) {     if(pFormatCtx-&gt;streams[i]-&gt;codec-&gt;codec_type==AVMEDIA_TYPE_VIDEO &amp;&amp;        video_index &lt; 0) {       video_index=i;     }     if(pFormatCtx-&gt;streams[i]-&gt;codec-&gt;codec_type==AVMEDIA_TYPE_AUDIO &amp;&amp;        audio_index &lt; 0) {       audio_index=i;     }   }   if(audio_index &gt;= 0) {     stream_component_open(is, audio_index);   }   if(video_index &gt;= 0) {     stream_component_open(is, video_index);   }       if(is-&gt;videoStream &lt; 0 || is-&gt;audioStream &lt; 0) {     fprintf(stderr, &quot;%s: could not open codecs\\n&quot;, is-&gt;filename);     goto fail;   }    \/\/ main decode loop    for(;;) {     if(is-&gt;quit) {       break;     }     \/\/ seek stuff goes here     if(is-&gt;audioq.size &gt; MAX_AUDIOQ_SIZE ||        is-&gt;videoq.size &gt; MAX_VIDEOQ_SIZE) {       SDL_Delay(10);       continue;     }     if(av_read_frame(is-&gt;pFormatCtx, packet) &lt; 0) {       if(is-&gt;pFormatCtx-&gt;pb-&gt;error == 0) { \tSDL_Delay(100); \/* no error; wait for user input *\/ \tcontinue;       } else { \tbreak;       }     }     \/\/ Is this a packet from the video stream?     if(packet-&gt;stream_index == is-&gt;videoStream) {       packet_queue_put(&amp;is-&gt;videoq, packet);     } else if(packet-&gt;stream_index == is-&gt;audioStream) {       packet_queue_put(&amp;is-&gt;audioq, packet);     } else {       av_free_packet(packet);     }   }   \/* all done - wait for it *\/   while(!is-&gt;quit) {     SDL_Delay(100);   }   fail:   if(1){     SDL_Event event;     event.type = FF_QUIT_EVENT;     event.user.data1 = is;     SDL_PushEvent(&amp;event);   }   return 0; }  int main(int argc, char *argv[]) {    SDL_Event       event;    VideoState      *is;    is = av_mallocz(sizeof(VideoState));    if(argc &lt; 2) {     fprintf(stderr, &quot;Usage: test &lt;file&gt;\\n&quot;);     exit(1);   }   \/\/ Register all formats and codecs   av_register_all();      if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {     fprintf(stderr, &quot;Could not initialize SDL - %s\\n&quot;, SDL_GetError());     exit(1);   }    \/\/ Make a screen to put our video #ifndef __DARWIN__         screen = SDL_SetVideoMode(640, 480, 0, 0); #else         screen = SDL_SetVideoMode(640, 480, 24, 0); #endif   if(!screen) {     fprintf(stderr, &quot;SDL: could not set video mode - exiting\\n&quot;);     exit(1);   }    screen_mutex = SDL_CreateMutex();    av_strlcpy(is-&gt;filename, argv[1], sizeof(is-&gt;filename));    is-&gt;pictq_mutex = SDL_CreateMutex();   is-&gt;pictq_cond = SDL_CreateCond();    schedule_refresh(is, 40);    is-&gt;av_sync_type = DEFAULT_AV_SYNC_TYPE;   is-&gt;parse_tid = SDL_CreateThread(decode_thread, is);   if(!is-&gt;parse_tid) {     av_free(is);     return -1;   }   for(;;) {      SDL_WaitEvent(&amp;event);     switch(event.type) {     case FF_QUIT_EVENT:     case SDL_QUIT:       is-&gt;quit = 1;       SDL_Quit();       return 0;       break;     case FF_REFRESH_EVENT:       video_refresh_timer(event.user.data1);       break;     default:       break;     }   }   return 0; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0438\u0441\u0442\u043e\u0439\u043d\u044b\u0439 \u043f\u043b\u0435\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0438\u043d\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0432\u0435\u0434\u0451\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0446\u044b \u0441 \u043a\u043e\u043d\u0446\u0430\u043c\u0438. \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u043c\u044b \u0441\u043b\u0435\u0433\u043a\u0430 \u043a\u043e\u0441\u043d\u0443\u043b\u0438\u0441\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0432\u0443\u043a\u0430 \u0441 \u0432\u0438\u0434\u0435\u043e, \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043c\u0430\u043a\u0430\u0440\u043e\u043c, \u043a\u0430\u043a \u0438 \u0441 \u0432\u0438\u0434\u0435\u043e: \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a, \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0430\u0443\u0434\u0438\u043e. \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u043e\u0431\u0449\u0438\u043c \u2014 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0447\u0430\u0441\u0430\u043c\u0438.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u044b, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u043e\u0447\u0430\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437: \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0438\u0434\u0435\u043e. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u0430\u043a \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0438\u043c <b>PTS<\/b> \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u0435\u0436\u0434\u0443 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440\u0430\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u0440\u0435\u043c\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u044b \u043d\u0430 <b>PTS<\/b> \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 <b>PTS_of_last_frame<\/b> + (<b>current_time<\/b> \u2014 <b>time_elapsed_since_PTS_value_was_set<\/b>). \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441 <b>get_audio_clock<\/b>.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0432 \u043d\u0430\u0448\u0443 \u043f\u043e\u043b\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c <b>double video_current_pts<\/b> \u0438 <b>int64_t video_current_pts_time<\/b>. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>video_refresh_timer<\/b>:<\/p>\n<pre><code class=\"cpp\">void video_refresh_timer(void *userdata) {    \/* ... *\/    if(is-&gt;video_st) {     if(is-&gt;pictq_size == 0) {       schedule_refresh(is, 1);     } else {       vp = &amp;is-&gt;pictq[is-&gt;pictq_rindex];        is-&gt;video_current_pts = vp-&gt;pts;       is-&gt;video_current_pts_time = av_gettime();<\/code><\/pre>\n<p>  \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 <b>stream_component_open<\/b>:<\/p>\n<pre><code class=\"cpp\">is-&gt;video_current_pts_time = av_gettime();<\/code><\/pre>\n<p>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"cpp\">double get_video_clock(VideoState *is) {   double delta;    delta = (av_gettime() - is-&gt;video_current_pts_time) \/ 1000000.0;   return is-&gt;video_current_pts + delta; }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0410\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u044f\u0441\u044c \u043e\u0442 \u0447\u0430\u0441\u043e\u0432<\/h3>\n<p>  \u041d\u043e \u0437\u0430\u0447\u0435\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0431\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u044b? \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0438\u0434\u0435\u043e, \u0447\u0442\u043e\u0431\u044b \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0440\u0434\u0430\u043a, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u043f\u0446\u0438\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0430\u043a \u0432 FFplay. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u0435\u043c\u0441\u044f: \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0435\u0440\u0442\u043a\u0443, <b>get_master_clock<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <b>av_sync_type<\/b>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <b>get_audio_clock<\/b>, <b>get_video_clock<\/b> \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0437\u043e\u0432\u0435\u043c <b>get_external_clock<\/b>:<\/p>\n<pre><code class=\"cpp\">enum {   AV_SYNC_AUDIO_MASTER,   AV_SYNC_VIDEO_MASTER,   AV_SYNC_EXTERNAL_MASTER, };  #define DEFAULT_AV_SYNC_TYPE AV_SYNC_VIDEO_MASTER  double get_master_clock(VideoState *is) {   if(is-&gt;av_sync_type == AV_SYNC_VIDEO_MASTER) {     return get_video_clock(is);   } else if(is-&gt;av_sync_type == AV_SYNC_AUDIO_MASTER) {     return get_audio_clock(is);   } else {     return get_external_clock(is);   } } main() { ...   is-&gt;av_sync_type = DEFAULT_AV_SYNC_TYPE; ... }<\/code><\/pre>\n<p>  <\/p>\n<h3>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0441 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u0430\u043c\u0438. \u041d\u0430\u0448\u0430 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u044c, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0430\u0443\u0434\u0438\u043e, \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u0430\u043c\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u043c \u0443\u0441\u043a\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u044c\u0441\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f?<\/p>\n<p>  \u041c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>synchronize_audio<\/b> \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u043e\u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f, \u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0430\u0443\u0434\u0438\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0447\u0430\u0449\u0435, \u0447\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0418\u0442\u0430\u043a, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>synchronize_audio<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u043c\u0438, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0443\u0434\u043e\u0441\u0443\u0436\u0438\u043c\u0441\u044f \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437, \u00ab\u043d\u0435\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u00bb \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0430\u0443\u0434\u0438\u043e\u0447\u0430\u0441\u044b \u0438 \u0432\u0438\u0434\u0435\u043e\u0447\u0430\u0441\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0435\u043c \u043f\u043e\u0440\u043e\u0433 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0441\u043a\u0430\u0436\u0435\u043c, <b>\u0441<\/b>, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 <b>N<\/b> \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0430\u0443\u0434\u0438\u043e\u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043d\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0433 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 40 \u043c\u0441, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 50 \u043c\u0441 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e \u043c\u044b \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b, \u0447\u0435\u043c \u0442\u0435, \u0447\u0442\u043e \u0438\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438. \u0418\u0442\u0430\u043a, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0441\u043a\u0430\u0436\u0435\u043c, <b>c<\/b>, \u0438 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <b>diff_sum<\/b> = <b>new_diff<\/b> + <b>diff_sum<\/b> * <b>c<\/b>. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043d\u0430\u0439\u0442\u0438 \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c <b>avg_diff<\/b> = <b>diff_sum<\/b> * (1 \u2212 <b>c<\/b>).<\/p>\n<p>  \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c, \u0447\u0451\u0440\u0442 \u0432\u043e\u0437\u044c\u043c\u0438, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442? \u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043c\u0430\u0433\u0438\u044f. \u041d\u0443, \u044d\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0437\u0432\u0435\u0448\u0435\u043d\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0441\u043e\u0432. \u042f \u043d\u0435 \u0437\u043d\u0430\u044e, \u0435\u0441\u0442\u044c \u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e (\u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0432 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438!), \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432\u043e\u0442 <a href=\"http:\/\/dranger.com\/ffmpeg\/weightedmean.html\">\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/a> (\u0438\u043b\u0438 \u0432\u043e\u0442: <a href=\"http:\/\/dranger.com\/ffmpeg\/weightedmean.txt\">weightedmean.txt<\/a>).<\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">\/* Add or subtract samples to get a better sync, return new    audio buffer size *\/ int synchronize_audio(VideoState *is, short *samples, \t\t      int samples_size, double pts) {   int n;   double ref_clock;      n = 2 * is-&gt;audio_st-&gt;codec-&gt;channels;      if(is-&gt;av_sync_type != AV_SYNC_AUDIO_MASTER) {     double diff, avg_diff;     int wanted_size, min_size, max_size, nb_samples;          ref_clock = get_master_clock(is);     diff = get_audio_clock(is) - ref_clock;      if(diff &lt; AV_NOSYNC_THRESHOLD) {       \/\/ accumulate the diffs       is-&gt;audio_diff_cum = diff + is-&gt;audio_diff_avg_coef \t* is-&gt;audio_diff_cum;       if(is-&gt;audio_diff_avg_count &lt; AUDIO_DIFF_AVG_NB) { \tis-&gt;audio_diff_avg_count++;       } else { \tavg_diff = is-&gt;audio_diff_cum * (1.0 - is-&gt;audio_diff_avg_coef);         \/* Shrinking\/expanding buffer code.... *\/        }     } else {       \/* difference is TOO big; reset diff stuff *\/       is-&gt;audio_diff_avg_count = 0;       is-&gt;audio_diff_cum = 0;     }   }   return samples_size; }<\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e; \u043c\u044b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0432\u0443\u043a \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d \u0441 \u0432\u0438\u0434\u0435\u043e \u0438\u043b\u0438 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0447\u0430\u0441\u043e\u0432. \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u0421\u043e\u043a\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439\/\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434\u00bb:<\/p>\n<pre><code class=\"cpp\">if(fabs(avg_diff) &gt;= is-&gt;audio_diff_threshold) {   wanted_size = samples_size +    ((int)(diff * is-&gt;audio_st-&gt;codec-&gt;sample_rate) * n);   min_size = samples_size * ((100 - SAMPLE_CORRECTION_PERCENT_MAX)                              \/ 100);   max_size = samples_size * ((100 + SAMPLE_CORRECTION_PERCENT_MAX)                               \/ 100);   if(wanted_size &lt; min_size) {     wanted_size = min_size;   } else if (wanted_size &gt; max_size) {     wanted_size = max_size;   }<\/code><\/pre>\n<p>  \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e <b>audio_length<\/b> * (<b>sample_rate<\/b> * # <b>of channel<\/b> * 2) \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u0432 <b>audio_length<\/b> \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0430\u0443\u0434\u0438\u043e. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, \u043f\u043b\u044e\u0441 \u0438\u043b\u0438 \u043c\u0438\u043d\u0443\u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u0437\u0432\u0443\u043a. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0435\u0434\u0435\u043b \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u043b\u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0448\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430\u0448 \u0431\u0443\u0444\u0435\u0440, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u043c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h3>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u044d\u043c\u043f\u043b\u043e\u0432<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0432\u0443\u043a. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b>synchronize_audio<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u044d\u043c\u043f\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043d\u0430\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u0443. \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u044d\u043c\u043f\u043b\u0430 \u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u044d\u043c\u043f\u043b\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u044d\u043c\u043f\u043b\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445! \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c. \u041d\u043e \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c? \u0411\u044b\u043b\u043e \u0431\u044b \u0433\u043b\u0443\u043f\u043e \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0443\u0434\u0438\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u044d\u043c\u043f\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">if(wanted_size &lt; samples_size) {   \/* remove samples *\/   samples_size = wanted_size; } else if(wanted_size &gt; samples_size) {   uint8_t *samples_end, *q;   int nb;    \/* add samples by copying final samples *\/   nb = (samples_size - wanted_size);   samples_end = (uint8_t *)samples + samples_size - n;   q = samples_end + n;   while(nb &gt; 0) {     memcpy(q, samples_end, n);     q += n;     nb -= n;   }   samples_size = wanted_size; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u044d\u043c\u043f\u043b\u0430, \u0438 \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439. \u0412\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0435\u0439\u0447\u0430\u0441, \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u043e:<\/p>\n<pre><code class=\"cpp\">void audio_callback(void *userdata, Uint8 *stream, int len) {    VideoState *is = (VideoState *)userdata;   int len1, audio_size;   double pts;    while(len &gt; 0) {     if(is-&gt;audio_buf_index &gt;= is-&gt;audio_buf_size) {       \/* We have already sent all our data; get more *\/       audio_size = audio_decode_frame(is, is-&gt;audio_buf, sizeof(is-&gt;audio_buf), &amp;pts);       if(audio_size &lt; 0) { \t\/* If error, output silence *\/ \tis-&gt;audio_buf_size = 1024; \tmemset(is-&gt;audio_buf, 0, is-&gt;audio_buf_size);       } else { \taudio_size = synchronize_audio(is, (int16_t *)is-&gt;audio_buf, \t\t\t\t       audio_size, pts); \tis-&gt;audio_buf_size = audio_size;<\/code><\/pre>\n<p>  \u0412\u0441\u0435, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u044d\u0442\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 <b>synchronize_audio<\/b>. (\u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0435 \u0443\u0434\u043e\u0441\u0443\u0436\u0438\u043b\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c.)<\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c: \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u00ab\u0435\u0441\u043b\u0438\u00bb, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u0438\u0434\u0435\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u044b:<\/p>\n<pre><code class=\"cpp\">if(is-&gt;av_sync_type != AV_SYNC_VIDEO_MASTER) {   ref_clock = get_master_clock(is);   diff = vp-&gt;pts - ref_clock;    \/* Skip or repeat the frame. Take delay into account      FFPlay still doesn't &quot;know if this is the best guess.&quot; *\/   sync_threshold = (delay &gt; AV_SYNC_THRESHOLD) ? delay :                     AV_SYNC_THRESHOLD;   if(fabs(diff) &lt; AV_NOSYNC_THRESHOLD) {     if(diff &lt;= -sync_threshold) {       delay = 0;     } else if(diff &gt;= sync_threshold) {       delay = 2 * delay;     }   } }<\/code><\/pre>\n<p>  \u0418 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0435 \u0443\u0434\u043e\u0441\u0443\u0436\u0438\u043b\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0417\u0430\u0442\u0435\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0439\u0442\u0435:<\/p>\n<pre><code class=\"bash\">gcc -o tutorial06 tutorial06.c -lavutil -lavformat -lavcodec -lswscale -lz -lm \\ `sdl-config --cflags --libs`<\/code><\/pre>\n<p>  \u0438 \u043f\u043e\u043b\u0451\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439.<\/p>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0443\u0440\u043e\u043a\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u043e\u0442\u043a\u0443.<a name=\"seeking\"><\/a><\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<h2>\u0423\u0440\u043e\u043a 7: \u041f\u043e\u0438\u0441\u043a <a href=\"#audio\" title=\"\u0423\u0440\u043e\u043a 6: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a> <a href=\"#epilogue\" title=\"\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435\">\u2192<\/a><\/h2>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 tutorial07.c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/ tutorial05.c \/\/ A pedagogical video player that really works! \/\/ \/\/ Code based on FFplay, Copyright (c) 2003 Fabrice Bellard,  \/\/ and a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de) \/\/ Tested on Gentoo, CVS version 5\/01\/07 compiled with GCC 4.1.1 \/\/ With updates from https:\/\/github.com\/chelyaev\/ffmpeg-tutorial \/\/ Updates tested on: \/\/ LAVC 54.59.100, LAVF 54.29.104, LSWS 2.1.101, SDL 1.2.15 \/\/ on GCC 4.7.2 in Debian February 2015 \/\/ Use \/\/ \/\/ gcc -o tutorial05 tutorial05.c -lavformat -lavcodec -lswscale -lz -lm `sdl-config --cflags --libs` \/\/ to build (assuming libavformat and libavcodec are correctly installed,  \/\/ and assuming you have sdl-config. Please refer to SDL docs for your installation.) \/\/ \/\/ Run using \/\/ tutorial04 myvideofile.mpg \/\/ \/\/ to play the video stream on your screen.  #include &lt;libavcodec\/avcodec.h&gt; #include &lt;libavformat\/avformat.h&gt; #include &lt;libswscale\/swscale.h&gt;  #include &lt;SDL.h&gt; #include &lt;SDL_thread.h&gt;  #ifdef __MINGW32__ #undef main \/* Prevents SDL from overriding main() *\/ #endif  #include &lt;stdio.h&gt; #include &lt;assert.h&gt; #include &lt;math.h&gt;  \/\/ compatibility with newer API #if LIBAVCODEC_VERSION_INT &lt; AV_VERSION_INT(55,28,1) #define av_frame_alloc avcodec_alloc_frame #define av_frame_free avcodec_free_frame #endif  #define SDL_AUDIO_BUFFER_SIZE 1024 #define MAX_AUDIO_FRAME_SIZE 192000  #define MAX_AUDIOQ_SIZE (5 * 16 * 1024) #define MAX_VIDEOQ_SIZE (5 * 256 * 1024)  #define AV_SYNC_THRESHOLD 0.01 #define AV_NOSYNC_THRESHOLD 10.0  #define SAMPLE_CORRECTION_PERCENT_MAX 10 #define AUDIO_DIFF_AVG_NB 20  #define FF_REFRESH_EVENT (SDL_USEREVENT) #define FF_QUIT_EVENT (SDL_USEREVENT + 1)  #define VIDEO_PICTURE_QUEUE_SIZE 1  #define DEFAULT_AV_SYNC_TYPE AV_SYNC_VIDEO_MASTER  typedef struct PacketQueue {   AVPacketList *first_pkt, *last_pkt;   int nb_packets;   int size;   SDL_mutex *mutex;   SDL_cond *cond; } PacketQueue;   typedef struct VideoPicture {   SDL_Overlay *bmp;   int width, height; \/* source height &amp; width *\/   int allocated;   double pts; } VideoPicture;  typedef struct VideoState {    AVFormatContext *pFormatCtx;   int             videoStream, audioStream;    int             av_sync_type;   double          external_clock; \/* external clock base *\/   int64_t         external_clock_time;   int             seek_req;   int             seek_flags;   int64_t         seek_pos;    double          audio_clock;   AVStream        *audio_st;   AVCodecContext  *audio_ctx;   PacketQueue     audioq;   uint8_t         audio_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) \/ 2];   unsigned int    audio_buf_size;   unsigned int    audio_buf_index;   AVFrame         audio_frame;   AVPacket        audio_pkt;   uint8_t         *audio_pkt_data;   int             audio_pkt_size;   int             audio_hw_buf_size;   double          audio_diff_cum; \/* used for AV difference average computation *\/   double          audio_diff_avg_coef;   double          audio_diff_threshold;   int             audio_diff_avg_count;   double          frame_timer;   double          frame_last_pts;   double          frame_last_delay;   double          video_clock; \/\/\/&lt;pts of last decoded frame \/ predicted pts of next decoded frame   double          video_current_pts; \/\/\/&lt;current displayed pts (different from video_clock if frame fifos are used)   int64_t         video_current_pts_time;  \/\/\/&lt;time (av_gettime) at which we updated video_current_pts - used to have running video pts   AVStream        *video_st;   AVCodecContext  *video_ctx;   PacketQueue     videoq;   struct SwsContext *sws_ctx;    VideoPicture    pictq[VIDEO_PICTURE_QUEUE_SIZE];   int             pictq_size, pictq_rindex, pictq_windex;   SDL_mutex       *pictq_mutex;   SDL_cond        *pictq_cond;      SDL_Thread      *parse_tid;   SDL_Thread      *video_tid;    char            filename[1024];   int             quit; } VideoState;  enum {   AV_SYNC_AUDIO_MASTER,   AV_SYNC_VIDEO_MASTER,   AV_SYNC_EXTERNAL_MASTER, };  SDL_Surface     *screen; SDL_mutex       *screen_mutex;  \/* Since we only have one decoding thread, the Big Struct    can be global in case we need it. *\/ VideoState *global_video_state; AVPacket flush_pkt;  void packet_queue_init(PacketQueue *q) {   memset(q, 0, sizeof(PacketQueue));   q-&gt;mutex = SDL_CreateMutex();   q-&gt;cond = SDL_CreateCond(); }  int packet_queue_put(PacketQueue *q, AVPacket *pkt) {    AVPacketList *pkt1;   if(pkt != &amp;flush_pkt &amp;&amp; av_dup_packet(pkt) &lt; 0) {     return -1;   }   pkt1 = av_malloc(sizeof(AVPacketList));   if (!pkt1)     return -1;   pkt1-&gt;pkt = *pkt;   pkt1-&gt;next = NULL;      SDL_LockMutex(q-&gt;mutex);    if (!q-&gt;last_pkt)     q-&gt;first_pkt = pkt1;   else     q-&gt;last_pkt-&gt;next = pkt1;   q-&gt;last_pkt = pkt1;   q-&gt;nb_packets++;   q-&gt;size += pkt1-&gt;pkt.size;   SDL_CondSignal(q-&gt;cond);      SDL_UnlockMutex(q-&gt;mutex);   return 0; } static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) {   AVPacketList *pkt1;   int ret;    SDL_LockMutex(q-&gt;mutex);      for(;;) {          if(global_video_state-&gt;quit) {       ret = -1;       break;     }      pkt1 = q-&gt;first_pkt;     if (pkt1) {       q-&gt;first_pkt = pkt1-&gt;next;       if (!q-&gt;first_pkt) \tq-&gt;last_pkt = NULL;       q-&gt;nb_packets--;       q-&gt;size -= pkt1-&gt;pkt.size;       *pkt = pkt1-&gt;pkt;       av_free(pkt1);       ret = 1;       break;     } else if (!block) {       ret = 0;       break;     } else {       SDL_CondWait(q-&gt;cond, q-&gt;mutex);     }   }   SDL_UnlockMutex(q-&gt;mutex);   return ret; }  static void packet_queue_flush(PacketQueue *q) {   AVPacketList *pkt, *pkt1;    SDL_LockMutex(q-&gt;mutex);   for(pkt = q-&gt;first_pkt; pkt != NULL; pkt = pkt1) {     pkt1 = pkt-&gt;next;     av_free_packet(&amp;pkt-&gt;pkt);     av_freep(&amp;pkt);   }   q-&gt;last_pkt = NULL;   q-&gt;first_pkt = NULL;   q-&gt;nb_packets = 0;   q-&gt;size = 0;   SDL_UnlockMutex(q-&gt;mutex); }  double get_audio_clock(VideoState *is) {   double pts;   int hw_buf_size, bytes_per_sec, n;      pts = is-&gt;audio_clock; \/* maintained in the audio thread *\/   hw_buf_size = is-&gt;audio_buf_size - is-&gt;audio_buf_index;   bytes_per_sec = 0;   n = is-&gt;audio_ctx-&gt;channels * 2;   if(is-&gt;audio_st) {     bytes_per_sec = is-&gt;audio_ctx-&gt;sample_rate * n;   }   if(bytes_per_sec) {     pts -= (double)hw_buf_size \/ bytes_per_sec;   }   return pts; } double get_video_clock(VideoState *is) {   double delta;    delta = (av_gettime() - is-&gt;video_current_pts_time) \/ 1000000.0;   return is-&gt;video_current_pts + delta; } double get_external_clock(VideoState *is) {   return av_gettime() \/ 1000000.0; }  double get_master_clock(VideoState *is) {   if(is-&gt;av_sync_type == AV_SYNC_VIDEO_MASTER) {     return get_video_clock(is);   } else if(is-&gt;av_sync_type == AV_SYNC_AUDIO_MASTER) {     return get_audio_clock(is);   } else {     return get_external_clock(is);   } }   \/* Add or subtract samples to get a better sync, return new    audio buffer size *\/ int synchronize_audio(VideoState *is, short *samples, \t\t      int samples_size, double pts) {   int n;   double ref_clock;    n = 2 * is-&gt;audio_ctx-&gt;channels;      if(is-&gt;av_sync_type != AV_SYNC_AUDIO_MASTER) {     double diff, avg_diff;     int wanted_size, min_size, max_size \/*, nb_samples *\/;          ref_clock = get_master_clock(is);     diff = get_audio_clock(is) - ref_clock;      if(diff &lt; AV_NOSYNC_THRESHOLD) {       \/\/ accumulate the diffs       is-&gt;audio_diff_cum = diff + is-&gt;audio_diff_avg_coef \t* is-&gt;audio_diff_cum;       if(is-&gt;audio_diff_avg_count &lt; AUDIO_DIFF_AVG_NB) { \tis-&gt;audio_diff_avg_count++;       } else { \tavg_diff = is-&gt;audio_diff_cum * (1.0 - is-&gt;audio_diff_avg_coef); \tif(fabs(avg_diff) &gt;= is-&gt;audio_diff_threshold) { \t  wanted_size = samples_size + ((int)(diff * is-&gt;audio_ctx-&gt;sample_rate) * n); \t  min_size = samples_size * ((100 - SAMPLE_CORRECTION_PERCENT_MAX) \/ 100); \t  max_size = samples_size * ((100 + SAMPLE_CORRECTION_PERCENT_MAX) \/ 100); \t  if(wanted_size &lt; min_size) { \t    wanted_size = min_size; \t  } else if (wanted_size &gt; max_size) { \t    wanted_size = max_size; \t  } \t  if(wanted_size &lt; samples_size) { \t    \/* remove samples *\/ \t    samples_size = wanted_size; \t  } else if(wanted_size &gt; samples_size) { \t    uint8_t *samples_end, *q; \t    int nb;  \t    \/* add samples by copying final sample*\/ \t    nb = (samples_size - wanted_size); \t    samples_end = (uint8_t *)samples + samples_size - n; \t    q = samples_end + n; \t    while(nb &gt; 0) { \t      memcpy(q, samples_end, n); \t      q += n; \t      nb -= n; \t    } \t    samples_size = wanted_size; \t  } \t}       }     } else {       \/* difference is TOO big; reset diff stuff *\/       is-&gt;audio_diff_avg_count = 0;       is-&gt;audio_diff_cum = 0;     }   }   return samples_size; }  int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, double *pts_ptr) {    int len1, data_size = 0;   AVPacket *pkt = &amp;is-&gt;audio_pkt;   double pts;   int n;    for(;;) {     while(is-&gt;audio_pkt_size &gt; 0) {       int got_frame = 0;       len1 = avcodec_decode_audio4(is-&gt;audio_ctx, &amp;is-&gt;audio_frame, &amp;got_frame, pkt);       if(len1 &lt; 0) { \t\/* if error, skip frame *\/ \tis-&gt;audio_pkt_size = 0; \tbreak;       }       data_size = 0;       if(got_frame) { \tdata_size = av_samples_get_buffer_size(NULL,  \t\t\t\t\t       is-&gt;audio_ctx-&gt;channels, \t\t\t\t\t       is-&gt;audio_frame.nb_samples, \t\t\t\t\t       is-&gt;audio_ctx-&gt;sample_fmt, \t\t\t\t\t       1); \tassert(data_size &lt;= buf_size); \tmemcpy(audio_buf, is-&gt;audio_frame.data[0], data_size);       }       is-&gt;audio_pkt_data += len1;       is-&gt;audio_pkt_size -= len1;       if(data_size &lt;= 0) { \t\/* No data yet, get more frames *\/ \tcontinue;       }       pts = is-&gt;audio_clock;       *pts_ptr = pts;       n = 2 * is-&gt;audio_ctx-&gt;channels;       is-&gt;audio_clock += (double)data_size \/ \t(double)(n * is-&gt;audio_ctx-&gt;sample_rate);       \/* We have data, return it and come back for more later *\/       return data_size;     }     if(pkt-&gt;data)       av_free_packet(pkt);      if(is-&gt;quit) {       return -1;     }     \/* next packet *\/     if(packet_queue_get(&amp;is-&gt;audioq, pkt, 1) &lt; 0) {       return -1;     }     if(pkt-&gt;data == flush_pkt.data) {       avcodec_flush_buffers(is-&gt;audio_ctx);       continue;     }     is-&gt;audio_pkt_data = pkt-&gt;data;     is-&gt;audio_pkt_size = pkt-&gt;size;     \/* if update, update the audio clock w\/pts *\/     if(pkt-&gt;pts != AV_NOPTS_VALUE) {       is-&gt;audio_clock = av_q2d(is-&gt;audio_st-&gt;time_base)*pkt-&gt;pts;     }   } }  void audio_callback(void *userdata, Uint8 *stream, int len) {    VideoState *is = (VideoState *)userdata;   int len1, audio_size;   double pts;    while(len &gt; 0) {     if(is-&gt;audio_buf_index &gt;= is-&gt;audio_buf_size) {       \/* We have already sent all our data; get more *\/       audio_size = audio_decode_frame(is, is-&gt;audio_buf, sizeof(is-&gt;audio_buf), &amp;pts);       if(audio_size &lt; 0) { \t\/* If error, output silence *\/ \tis-&gt;audio_buf_size = 1024; \tmemset(is-&gt;audio_buf, 0, is-&gt;audio_buf_size);       } else { \taudio_size = synchronize_audio(is, (int16_t *)is-&gt;audio_buf, \t\t\t\t       audio_size, pts); \tis-&gt;audio_buf_size = audio_size;       }       is-&gt;audio_buf_index = 0;     }     len1 = is-&gt;audio_buf_size - is-&gt;audio_buf_index;     if(len1 &gt; len)       len1 = len;     memcpy(stream, (uint8_t *)is-&gt;audio_buf + is-&gt;audio_buf_index, len1);     len -= len1;     stream += len1;     is-&gt;audio_buf_index += len1;   } }  static Uint32 sdl_refresh_timer_cb(Uint32 interval, void *opaque) {   SDL_Event event;   event.type = FF_REFRESH_EVENT;   event.user.data1 = opaque;   SDL_PushEvent(&amp;event);   return 0; \/* 0 means stop timer *\/ }  \/* schedule a video refresh in 'delay' ms *\/ static void schedule_refresh(VideoState *is, int delay) {   SDL_AddTimer(delay, sdl_refresh_timer_cb, is); }  void video_display(VideoState *is) {    SDL_Rect rect;   VideoPicture *vp;   float aspect_ratio;   int w, h, x, y;   int i;    vp = &amp;is-&gt;pictq[is-&gt;pictq_rindex];   if(vp-&gt;bmp) {     if(is-&gt;video_ctx-&gt;sample_aspect_ratio.num == 0) {       aspect_ratio = 0;     } else {       aspect_ratio = av_q2d(is-&gt;video_ctx-&gt;sample_aspect_ratio) * \tis-&gt;video_ctx-&gt;width \/ is-&gt;video_ctx-&gt;height;     }     if(aspect_ratio &lt;= 0.0) {       aspect_ratio = (float)is-&gt;video_ctx-&gt;width \/ \t(float)is-&gt;video_ctx-&gt;height;     }     h = screen-&gt;h;     w = ((int)rint(h * aspect_ratio)) &amp; -3;     if(w &gt; screen-&gt;w) {       w = screen-&gt;w;       h = ((int)rint(w \/ aspect_ratio)) &amp; -3;     }     x = (screen-&gt;w - w) \/ 2;     y = (screen-&gt;h - h) \/ 2;          rect.x = x;     rect.y = y;     rect.w = w;     rect.h = h;     SDL_LockMutex(screen_mutex);     SDL_DisplayYUVOverlay(vp-&gt;bmp, &amp;rect);     SDL_UnlockMutex(screen_mutex);   } }  void video_refresh_timer(void *userdata) {    VideoState *is = (VideoState *)userdata;   VideoPicture *vp;   double actual_delay, delay, sync_threshold, ref_clock, diff;      if(is-&gt;video_st) {     if(is-&gt;pictq_size == 0) {       schedule_refresh(is, 1);     } else {       vp = &amp;is-&gt;pictq[is-&gt;pictq_rindex];              is-&gt;video_current_pts = vp-&gt;pts;       is-&gt;video_current_pts_time = av_gettime();       delay = vp-&gt;pts - is-&gt;frame_last_pts; \/* the pts from last time *\/       if(delay &lt;= 0 || delay &gt;= 1.0) { \t\/* if incorrect delay, use previous one *\/ \tdelay = is-&gt;frame_last_delay;       }       \/* save for next time *\/       is-&gt;frame_last_delay = delay;       is-&gt;frame_last_pts = vp-&gt;pts;          \/* update delay to sync to audio if not master source *\/       if(is-&gt;av_sync_type != AV_SYNC_VIDEO_MASTER) { \tref_clock = get_master_clock(is); \tdiff = vp-&gt;pts - ref_clock; \t \t\/* Skip or repeat the frame. Take delay into account \t   FFPlay still doesn't &quot;know if this is the best guess.&quot; *\/ \tsync_threshold = (delay &gt; AV_SYNC_THRESHOLD) ? delay : AV_SYNC_THRESHOLD; \tif(fabs(diff) &lt; AV_NOSYNC_THRESHOLD) { \t  if(diff &lt;= -sync_threshold) { \t    delay = 0; \t  } else if(diff &gt;= sync_threshold) { \t    delay = 2 * delay; \t  } \t}       }       is-&gt;frame_timer += delay;       \/* computer the REAL delay *\/       actual_delay = is-&gt;frame_timer - (av_gettime() \/ 1000000.0);       if(actual_delay &lt; 0.010) { \t\/* Really it should skip the picture instead *\/ \tactual_delay = 0.010;       }       schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));              \/* show the picture! *\/       video_display(is);              \/* update queue for next picture! *\/       if(++is-&gt;pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) { \tis-&gt;pictq_rindex = 0;       }       SDL_LockMutex(is-&gt;pictq_mutex);       is-&gt;pictq_size--;       SDL_CondSignal(is-&gt;pictq_cond);       SDL_UnlockMutex(is-&gt;pictq_mutex);     }   } else {     schedule_refresh(is, 100);   } }        void alloc_picture(void *userdata) {    VideoState *is = (VideoState *)userdata;   VideoPicture *vp;    vp = &amp;is-&gt;pictq[is-&gt;pictq_windex];   if(vp-&gt;bmp) {     \/\/ we already have one make another, bigger\/smaller     SDL_FreeYUVOverlay(vp-&gt;bmp);   }   \/\/ Allocate a place to put our YUV image on that screen   SDL_LockMutex(screen_mutex);   vp-&gt;bmp = SDL_CreateYUVOverlay(is-&gt;video_ctx-&gt;width, \t\t\t\t is-&gt;video_ctx-&gt;height, \t\t\t\t SDL_YV12_OVERLAY, \t\t\t\t screen);   SDL_UnlockMutex(screen_mutex);    vp-&gt;width = is-&gt;video_ctx-&gt;width;   vp-&gt;height = is-&gt;video_ctx-&gt;height;   vp-&gt;allocated = 1;  }  int queue_picture(VideoState *is, AVFrame *pFrame, double pts) {    VideoPicture *vp;   int dst_pix_fmt;   AVPicture pict;    \/* wait until we have space for a new pic *\/   SDL_LockMutex(is-&gt;pictq_mutex);   while(is-&gt;pictq_size &gt;= VIDEO_PICTURE_QUEUE_SIZE &amp;&amp; \t!is-&gt;quit) {     SDL_CondWait(is-&gt;pictq_cond, is-&gt;pictq_mutex);   }   SDL_UnlockMutex(is-&gt;pictq_mutex);    if(is-&gt;quit)     return -1;    \/\/ windex is set to 0 initially   vp = &amp;is-&gt;pictq[is-&gt;pictq_windex];    \/* allocate or resize the buffer! *\/   if(!vp-&gt;bmp ||      vp-&gt;width != is-&gt;video_ctx-&gt;width ||      vp-&gt;height != is-&gt;video_ctx-&gt;height) {     SDL_Event event;      vp-&gt;allocated = 0;     alloc_picture(is);     if(is-&gt;quit) {       return -1;     }   }   \/* We have a place to put our picture on the queue *\/    if(vp-&gt;bmp) {      SDL_LockYUVOverlay(vp-&gt;bmp);     vp-&gt;pts = pts;          dst_pix_fmt = PIX_FMT_YUV420P;     \/* point pict at the queue *\/      pict.data[0] = vp-&gt;bmp-&gt;pixels[0];     pict.data[1] = vp-&gt;bmp-&gt;pixels[2];     pict.data[2] = vp-&gt;bmp-&gt;pixels[1];          pict.linesize[0] = vp-&gt;bmp-&gt;pitches[0];     pict.linesize[1] = vp-&gt;bmp-&gt;pitches[2];     pict.linesize[2] = vp-&gt;bmp-&gt;pitches[1];          \/\/ Convert the image into YUV format that SDL uses     sws_scale(is-&gt;sws_ctx, (uint8_t const * const *)pFrame-&gt;data, \t      pFrame-&gt;linesize, 0, is-&gt;video_ctx-&gt;height, \t      pict.data, pict.linesize);          SDL_UnlockYUVOverlay(vp-&gt;bmp);     \/* now we inform our display thread that we have a pic ready *\/     if(++is-&gt;pictq_windex == VIDEO_PICTURE_QUEUE_SIZE) {       is-&gt;pictq_windex = 0;     }     SDL_LockMutex(is-&gt;pictq_mutex);     is-&gt;pictq_size++;     SDL_UnlockMutex(is-&gt;pictq_mutex);   }   return 0; }  double synchronize_video(VideoState *is, AVFrame *src_frame, double pts) {    double frame_delay;    if(pts != 0) {     \/* if we have pts, set video clock to it *\/     is-&gt;video_clock = pts;   } else {     \/* if we aren't given a pts, set it to the clock *\/     pts = is-&gt;video_clock;   }   \/* update the video clock *\/   frame_delay = av_q2d(is-&gt;video_ctx-&gt;time_base);   \/* if we are repeating a frame, adjust clock accordingly *\/   frame_delay += src_frame-&gt;repeat_pict * (frame_delay * 0.5);   is-&gt;video_clock += frame_delay;   return pts; }  int video_thread(void *arg) {   VideoState *is = (VideoState *)arg;   AVPacket pkt1, *packet = &amp;pkt1;   int frameFinished;   AVFrame *pFrame;   double pts;    pFrame = av_frame_alloc();    for(;;) {     if(packet_queue_get(&amp;is-&gt;videoq, packet, 1) &lt; 0) {       \/\/ means we quit getting packets       break;     }     if(packet_queue_get(&amp;is-&gt;videoq, packet, 1) &lt; 0) {       \/\/ means we quit getting packets       break;     }     pts = 0;      \/\/ Decode video frame     avcodec_decode_video2(is-&gt;video_ctx, pFrame, &amp;frameFinished, packet);      if((pts = av_frame_get_best_effort_timestamp(pFrame)) == AV_NOPTS_VALUE) {       pts = av_frame_get_best_effort_timestamp(pFrame);     } else {       pts = 0;     }     pts *= av_q2d(is-&gt;video_st-&gt;time_base);      \/\/ Did we get a video frame?     if(frameFinished) {       pts = synchronize_video(is, pFrame, pts);       if(queue_picture(is, pFrame, pts) &lt; 0) { \tbreak;       }     }     av_free_packet(packet);   }   av_frame_free(&amp;pFrame);   return 0; }  int stream_component_open(VideoState *is, int stream_index) {    AVFormatContext *pFormatCtx = is-&gt;pFormatCtx;   AVCodecContext *codecCtx = NULL;   AVCodec *codec = NULL;   SDL_AudioSpec wanted_spec, spec;    if(stream_index &lt; 0 || stream_index &gt;= pFormatCtx-&gt;nb_streams) {     return -1;   }    codec = avcodec_find_decoder(pFormatCtx-&gt;streams[stream_index]-&gt;codec-&gt;codec_id);   if(!codec) {     fprintf(stderr, &quot;Unsupported codec!\\n&quot;);     return -1;   }    codecCtx = avcodec_alloc_context3(codec);   if(avcodec_copy_context(codecCtx, pFormatCtx-&gt;streams[stream_index]-&gt;codec) != 0) {     fprintf(stderr, &quot;Couldn't copy codec context&quot;);     return -1; \/\/ Error copying codec context   }     if(codecCtx-&gt;codec_type == AVMEDIA_TYPE_AUDIO) {     \/\/ Set audio settings from codec info     wanted_spec.freq = codecCtx-&gt;sample_rate;     wanted_spec.format = AUDIO_S16SYS;     wanted_spec.channels = codecCtx-&gt;channels;     wanted_spec.silence = 0;     wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;     wanted_spec.callback = audio_callback;     wanted_spec.userdata = is;          if(SDL_OpenAudio(&amp;wanted_spec, &amp;spec) &lt; 0) {       fprintf(stderr, &quot;SDL_OpenAudio: %s\\n&quot;, SDL_GetError());       return -1;     }     is-&gt;audio_hw_buf_size = spec.size;   }   if(avcodec_open2(codecCtx, codec, NULL) &lt; 0) {     fprintf(stderr, &quot;Unsupported codec!\\n&quot;);     return -1;   }    switch(codecCtx-&gt;codec_type) {   case AVMEDIA_TYPE_AUDIO:     is-&gt;audioStream = stream_index;     is-&gt;audio_st = pFormatCtx-&gt;streams[stream_index];     is-&gt;audio_ctx = codecCtx;     is-&gt;audio_buf_size = 0;     is-&gt;audio_buf_index = 0;     memset(&amp;is-&gt;audio_pkt, 0, sizeof(is-&gt;audio_pkt));     packet_queue_init(&amp;is-&gt;audioq);     SDL_PauseAudio(0);     break;   case AVMEDIA_TYPE_VIDEO:     is-&gt;videoStream = stream_index;     is-&gt;video_st = pFormatCtx-&gt;streams[stream_index];     is-&gt;video_ctx = codecCtx;      is-&gt;frame_timer = (double)av_gettime() \/ 1000000.0;     is-&gt;frame_last_delay = 40e-3;     is-&gt;video_current_pts_time = av_gettime();      packet_queue_init(&amp;is-&gt;videoq);     is-&gt;video_tid = SDL_CreateThread(video_thread, is);     is-&gt;sws_ctx = sws_getContext(is-&gt;video_ctx-&gt;width, is-&gt;video_ctx-&gt;height, \t\t\t\t is-&gt;video_ctx-&gt;pix_fmt, is-&gt;video_ctx-&gt;width, \t\t\t\t is-&gt;video_ctx-&gt;height, PIX_FMT_YUV420P, \t\t\t\t SWS_BILINEAR, NULL, NULL, NULL \t\t\t\t );     break;   default:     break;   } }  int decode_thread(void *arg) {    VideoState *is = (VideoState *)arg;   AVFormatContext *pFormatCtx;   AVPacket pkt1, *packet = &amp;pkt1;    int video_index = -1;   int audio_index = -1;   int i;    is-&gt;videoStream=-1;   is-&gt;audioStream=-1;    global_video_state = is;    \/\/ Open video file   if(avformat_open_input(&amp;pFormatCtx, is-&gt;filename, NULL, NULL)!=0)     return -1; \/\/ Couldn't open file    is-&gt;pFormatCtx = pFormatCtx;      \/\/ Retrieve stream information   if(avformat_find_stream_info(pFormatCtx, NULL)&lt;0)     return -1; \/\/ Couldn't find stream information      \/\/ Dump information about file onto standard error   av_dump_format(pFormatCtx, 0, is-&gt;filename, 0);      \/\/ Find the first video stream    for(i=0; i&lt;pFormatCtx-&gt;nb_streams; i++) {     if(pFormatCtx-&gt;streams[i]-&gt;codec-&gt;codec_type==AVMEDIA_TYPE_VIDEO &amp;&amp;        video_index &lt; 0) {       video_index=i;     }     if(pFormatCtx-&gt;streams[i]-&gt;codec-&gt;codec_type==AVMEDIA_TYPE_AUDIO &amp;&amp;        audio_index &lt; 0) {       audio_index=i;     }   }   if(audio_index &gt;= 0) {     stream_component_open(is, audio_index);   }   if(video_index &gt;= 0) {     stream_component_open(is, video_index);   }       if(is-&gt;videoStream &lt; 0 || is-&gt;audioStream &lt; 0) {     fprintf(stderr, &quot;%s: could not open codecs\\n&quot;, is-&gt;filename);     goto fail;   }    \/\/ main decode loop    for(;;) {     if(is-&gt;quit) {       break;     }     \/\/ seek stuff goes here     if(is-&gt;seek_req) {       int stream_index= -1;       int64_t seek_target = is-&gt;seek_pos;        if     (is-&gt;videoStream &gt;= 0) stream_index = is-&gt;videoStream;       else if(is-&gt;audioStream &gt;= 0) stream_index = is-&gt;audioStream;        if(stream_index&gt;=0){ \tseek_target= av_rescale_q(seek_target, AV_TIME_BASE_Q, \t\t\t\t  pFormatCtx-&gt;streams[stream_index]-&gt;time_base);       }       if(av_seek_frame(is-&gt;pFormatCtx, stream_index,  \t\t       seek_target, is-&gt;seek_flags) &lt; 0) { \tfprintf(stderr, &quot;%s: error while seeking\\n&quot;, \t\tis-&gt;pFormatCtx-&gt;filename);       } else {  \tif(is-&gt;audioStream &gt;= 0) { \t  packet_queue_flush(&amp;is-&gt;audioq); \t  packet_queue_put(&amp;is-&gt;audioq, &amp;flush_pkt); \t} \tif(is-&gt;videoStream &gt;= 0) { \t  packet_queue_flush(&amp;is-&gt;videoq); \t  packet_queue_put(&amp;is-&gt;videoq, &amp;flush_pkt); \t}       }       is-&gt;seek_req = 0;     }      if(is-&gt;audioq.size &gt; MAX_AUDIOQ_SIZE ||        is-&gt;videoq.size &gt; MAX_VIDEOQ_SIZE) {       SDL_Delay(10);       continue;     }     if(av_read_frame(is-&gt;pFormatCtx, packet) &lt; 0) {       if(is-&gt;pFormatCtx-&gt;pb-&gt;error == 0) { \tSDL_Delay(100); \/* no error; wait for user input *\/ \tcontinue;       } else { \tbreak;       }     }     \/\/ Is this a packet from the video stream?     if(packet-&gt;stream_index == is-&gt;videoStream) {       packet_queue_put(&amp;is-&gt;videoq, packet);     } else if(packet-&gt;stream_index == is-&gt;audioStream) {       packet_queue_put(&amp;is-&gt;audioq, packet);     } else {       av_free_packet(packet);     }   }   \/* all done - wait for it *\/   while(!is-&gt;quit) {     SDL_Delay(100);   }   fail:   if(1){     SDL_Event event;     event.type = FF_QUIT_EVENT;     event.user.data1 = is;     SDL_PushEvent(&amp;event);   }   return 0; }  void stream_seek(VideoState *is, int64_t pos, int rel) {    if(!is-&gt;seek_req) {     is-&gt;seek_pos = pos;     is-&gt;seek_flags = rel &lt; 0 ? AVSEEK_FLAG_BACKWARD : 0;     is-&gt;seek_req = 1;   } }  int main(int argc, char *argv[]) {    SDL_Event       event;    VideoState      *is;    is = av_mallocz(sizeof(VideoState));    if(argc &lt; 2) {     fprintf(stderr, &quot;Usage: test &lt;file&gt;\\n&quot;);     exit(1);   }   \/\/ Register all formats and codecs   av_register_all();      if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {     fprintf(stderr, &quot;Could not initialize SDL - %s\\n&quot;, SDL_GetError());     exit(1);   }    \/\/ Make a screen to put our video #ifndef __DARWIN__         screen = SDL_SetVideoMode(640, 480, 0, 0); #else         screen = SDL_SetVideoMode(640, 480, 24, 0); #endif   if(!screen) {     fprintf(stderr, &quot;SDL: could not set video mode - exiting\\n&quot;);     exit(1);   }    screen_mutex = SDL_CreateMutex();    av_strlcpy(is-&gt;filename, argv[1], sizeof(is-&gt;filename));    is-&gt;pictq_mutex = SDL_CreateMutex();   is-&gt;pictq_cond = SDL_CreateCond();    schedule_refresh(is, 40);    is-&gt;av_sync_type = DEFAULT_AV_SYNC_TYPE;   is-&gt;parse_tid = SDL_CreateThread(decode_thread, is);   if(!is-&gt;parse_tid) {     av_free(is);     return -1;   }    av_init_packet(&amp;flush_pkt);   flush_pkt.data = &quot;FLUSH&quot;;    for(;;) {     double incr, pos;     SDL_WaitEvent(&amp;event);     switch(event.type) {     case SDL_KEYDOWN:       switch(event.key.keysym.sym) {       case SDLK_LEFT: \tincr = -10.0; \tgoto do_seek;       case SDLK_RIGHT: \tincr = 10.0; \tgoto do_seek;       case SDLK_UP: \tincr = 60.0; \tgoto do_seek;       case SDLK_DOWN: \tincr = -60.0; \tgoto do_seek;       do_seek: \tif(global_video_state) { \t  pos = get_master_clock(global_video_state); \t  pos += incr; \t  stream_seek(global_video_state, (int64_t)(pos * AV_TIME_BASE), incr); \t} \tbreak;       default: \tbreak;       }       break;     case FF_QUIT_EVENT:     case SDL_QUIT:       is-&gt;quit = 1;       \/*        * If the video has finished playing, then both the picture and        * audio queues are waiting for more data.  Make them stop        * waiting and terminate normally.        *\/       SDL_CondSignal(is-&gt;audioq.cond);       SDL_CondSignal(is-&gt;videoq.cond);       SDL_Quit();       return 0;       break;     case FF_REFRESH_EVENT:       video_refresh_timer(event.user.data1);       break;     default:       break;     }   }   return 0;  } <\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u043b\u0435\u0435\u0440\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u043c\u043e\u0442\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u043c \u043d\u0430\u0437\u0430\u0434. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>av_seek_frame<\/b>.<\/p>\n<p>  \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435 \u00ab\u0432\u043b\u0435\u0432\u043e\u00bb \u0438 \u00ab\u0432\u043f\u0440\u0430\u0432\u043e\u00bb \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u043b\u0438 \u0444\u0438\u043b\u044c\u043c \u0432\u043f\u0435\u0440\u0435\u0434 \u0438 \u043d\u0430\u0437\u0430\u0434 \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0430 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u0438 \u00ab\u0432\u043d\u0438\u0437\u00bb \u2014 \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u00ab\u041d\u0435\u043c\u043d\u043e\u0433\u043e\u00bb \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 10 \u0441\u0435\u043a\u0443\u043d\u0434, \u0430 \u00ab\u043c\u043d\u043e\u0433\u043e\u00bb \u2014 \u0432\u0441\u0435 60. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430\u0448 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448. \u041d\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c <b>av_seek_frame<\/b> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0446\u0438\u043a\u043b\u0435 <b>decode_thread<\/b>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">  int             seek_req;   int             seek_flags;   int64_t         seek_pos;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430\u0448 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b, \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448:<\/p>\n<pre><code class=\"cpp\">  for(;;) {     double incr, pos;      SDL_WaitEvent(&amp;event);     switch(event.type) {     case SDL_KEYDOWN:       switch(event.key.keysym.sym) {       case SDLK_LEFT: \tincr = -10.0; \tgoto do_seek;       case SDLK_RIGHT: \tincr = 10.0; \tgoto do_seek;       case SDLK_UP: \tincr = 60.0; \tgoto do_seek;       case SDLK_DOWN: \tincr = -60.0; \tgoto do_seek;       do_seek: \tif(global_video_state) { \t  pos = get_master_clock(global_video_state); \t  pos += incr; \t  stream_seek(global_video_state,                        (int64_t)(pos * AV_TIME_BASE), incr); \t} \tbreak;       default: \tbreak;       }       break;<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043b\u0438 \u043c\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <b>SDL_KEYDOWN<\/b>. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u044e\u0447 \u043f\u043e\u043b\u0443\u0447\u0435\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <nobr><b>event.key.keysym.sym<\/b><\/nobr>. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c, \u0432 \u043a\u0430\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u0449\u0435\u043c, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>get_master_clock<\/b>. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>stream_seek<\/b> \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <b>seek_pos<\/b> \u0438 \u0442.\u0434. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043d\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043c\u0435\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <b>avcodec<\/b>. \u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043a\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0430\u0434\u0440\u0430\u0445, \u0430 \u043d\u0435 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u043f\u043e \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435: <nobr><b>\u0441\u0435\u043a\u0443\u043d\u0434\u044b<\/b> = <b>\u043a\u0430\u0434\u0440\u044b<\/b> * <b>time_base<\/b>(<b>fps<\/b>).<\/nobr> \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f <b>avcodec<\/b> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1000000 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 2000000). \u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  \u0412\u043e\u0442 \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b>stream_seek<\/b>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0444\u043b\u0430\u0433, \u0435\u0441\u043b\u0438 \u0438\u0434\u0435\u043c \u043d\u0430\u0437\u0430\u0434:<\/p>\n<pre><code class=\"cpp\">void stream_seek(VideoState *is, int64_t pos, int rel) {    if(!is-&gt;seek_req) {     is-&gt;seek_pos = pos;     is-&gt;seek_flags = rel &lt; 0 ? AVSEEK_FLAG_BACKWARD : 0;     is-&gt;seek_req = 1;   } }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u0448\u0435\u0439 <b>decode_thread<\/b>, \u0433\u0434\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043f\u043e\u0438\u0441\u043a. \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043c\u0435\u0442\u0438\u043b\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u00ab\u0437\u0434\u0435\u0441\u044c \u0438\u0434\u0451\u0442 \u043f\u043e\u0438\u0441\u043a\u00bb. \u041d\u0443, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0442\u0430\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>  \u041f\u043e\u0438\u0441\u043a \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d \u0432\u043e\u043a\u0440\u0443\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>av_seek_frame<\/b>. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043f\u043e\u0442\u043e\u043a, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043c\u0435\u0442\u043a\u0443 \u0438 \u043d\u0430\u0431\u043e\u0440 \u0444\u043b\u0430\u0433\u043e\u0432. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0435\u0439 \u0434\u0430\u0434\u0438\u0442\u0435. \u0415\u0434\u0438\u043d\u0438\u0446\u0435\u0439 \u043e\u0442\u043c\u0435\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <b>time_base<\/b> \u043f\u043e\u0442\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u043e\u0442\u043e\u043a (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f -1). \u0415\u0441\u043b\u0438 \u0432\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442\u0435, <b>time_base<\/b> \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <b>avcodec<\/b> \u0438\u043b\u0438 1000000fps. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043d\u0430 <b>AV_TIME_BASE<\/b>, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 <b>seek_pos<\/b>.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 (\u0440\u0435\u0434\u043a\u043e) \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c\u0438 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0435 <nobr><b>av_seek_frame<\/b> \u2212 1<\/nobr> \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432 \u043d\u0430\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e <b>av_seek_frame<\/b>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u043d\u0430\u0448\u0435\u0439 \u043c\u0435\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u043e\u0432\u043e\u0439 \u00ab\u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u00bb.<\/p>\n<pre><code class=\"cpp\">if(is-&gt;seek_req) {   int stream_index= -1;   int64_t seek_target = is-&gt;seek_pos;    if     (is-&gt;videoStream &gt;= 0) stream_index = is-&gt;videoStream;   else if(is-&gt;audioStream &gt;= 0) stream_index = is-&gt;audioStream;    if(stream_index&gt;=0){     seek_target= av_rescale_q(seek_target, AV_TIME_BASE_Q,                       pFormatCtx-&gt;streams[stream_index]-&gt;time_base);   }   if(av_seek_frame(is-&gt;pFormatCtx, stream_index,                      seek_target, is-&gt;seek_flags) &lt; 0) {     fprintf(stderr, &quot;%s: error while seeking\\n&quot;,             is-&gt;pFormatCtx-&gt;filename);   } else {      \/* handle packet queues... more later... *\/ <\/code><\/pre>\n<p>  <b>av_rescale_q<\/b>(<b>a<\/b>, <b>b<\/b>, <b>c<\/b>) \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u0301\u044e \u043c\u0435\u0442\u043a\u0443 \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u043a \u0434\u0440\u0443\u0433\u043e\u0439. \u041e\u043d \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 <nobr><b>a<\/b> * <b>b<\/b> \/ <b>c<\/b><\/nobr>, \u043d\u043e \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. <b>AV_TIME_BASE_Q<\/b> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 <b>AV_TIME_BASE<\/b>. \u041e\u043d\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435: <nobr><b>AV_TIME_BASE<\/b> * <b>time_in_seconds<\/b> = <b>avcodec_timestamp<\/b><\/nobr> \u0438 <nobr><b>AV_TIME_BASE_Q<\/b> * <b>avcodec_timestamp<\/b> = <b>time_in_seconds<\/b><\/nobr> (\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <b>AV_TIME_BASE_Q<\/b> \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c <b>AVRational<\/b>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>q<\/b> \u0432 <b>avcodec<\/b> \u0434\u043b\u044f \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438).<\/p>\n<h3>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0431\u0443\u0444\u0435\u0440\u043e\u0432<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043d\u0430\u0448\u0438 \u043f\u043e\u0438\u0441\u043a\u0438, \u043d\u043e \u043f\u043e\u043a\u0430 \u0435\u0449\u0451 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438. \u041f\u0440\u0438\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0435, \u0443 \u043d\u0430\u0441 \u0432\u0435\u0434\u044c \u0435\u0441\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432? \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043a\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u0443\u0436\u043d\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438\u043d\u0430\u0447\u0435 \u043f\u043e\u0438\u0441\u043a \u0432 \u0444\u0438\u043b\u044c\u043c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c! \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, <b>avcodec<\/b> \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0447\u0438\u0449\u0435\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043e\u0447\u0438\u0449\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u0448\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e- \u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a, \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0447\u0438\u0449\u0430\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u044b <b>avcodec<\/b>. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u043e\u0447\u0438\u0441\u0442\u043a\u0438, \u0438 \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 (\u043f\u043e\u0442\u043e\u043a\u0438) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0430\u0442 \u044d\u0442\u043e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0447\u0438\u0441\u0442\u044f\u0442 \u0441\u0432\u043e\u0438 \u0431\u0443\u0444\u0435\u0440\u044b.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0431\u0440\u043e\u0441\u0430. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">static void packet_queue_flush(PacketQueue *q) {   AVPacketList *pkt, *pkt1;    SDL_LockMutex(q-&gt;mutex);   for(pkt = q-&gt;first_pkt; pkt != NULL; pkt = pkt1) {     pkt1 = pkt-&gt;next;     av_free_packet(&amp;pkt-&gt;pkt);     av_freep(&amp;pkt);   }   q-&gt;last_pkt = NULL;   q-&gt;first_pkt = NULL;   q-&gt;nb_packets = 0;   q-&gt;size = 0;   SDL_UnlockMutex(q-&gt;mutex); }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0447\u0438\u0449\u0435\u043d\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u0448 \u00ab\u043e\u0447\u0438\u0449\u0430\u044e\u0449\u0438\u0439 \u043f\u0430\u043a\u0435\u0442\u00bb. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0433\u043e:<\/p>\n<pre><code class=\"cpp\">AVPacket flush_pkt;  main() {   ...   av_init_packet(&amp;flush_pkt);   flush_pkt.data = &quot;FLUSH&quot;;   ... }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c:<\/p>\n<pre><code class=\"cpp\">  } else {     if(is-&gt;audioStream &gt;= 0) {       packet_queue_flush(&amp;is-&gt;audioq);       packet_queue_put(&amp;is-&gt;audioq, &amp;flush_pkt);     }     if(is-&gt;videoStream &gt;= 0) {       packet_queue_flush(&amp;is-&gt;videoq);       packet_queue_put(&amp;is-&gt;videoq, &amp;flush_pkt);     }   }   is-&gt;seek_req = 0; }<\/code><\/pre>\n<p>  (\u042d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f <b>decode_thread<\/b>.) \u041d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c <b>packet_queue_put<\/b>, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043d\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438:<\/p>\n<pre><code class=\"cpp\">int packet_queue_put(PacketQueue *q, AVPacket *pkt) {    AVPacketList *pkt1;   if(pkt != &amp;flush_pkt &amp;&amp; av_dup_packet(pkt) &lt; 0) {     return -1;   }<\/code><\/pre>\n<p>  \u0418 \u0437\u0430\u0442\u0435\u043c \u0432 \u0430\u0443\u0434\u0438\u043e- \u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a\u0435 \u043c\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432 <b>avcodec_flush_buffers<\/b> \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <b>packet_queue_get<\/b>:<\/p>\n<pre><code class=\"cpp\">    if(packet_queue_get(&amp;is-&gt;audioq, pkt, 1) &lt; 0) {       return -1;     }     if(pkt-&gt;data == flush_pkt.data) {       avcodec_flush_buffers(is-&gt;audio_st-&gt;codec);       continue;     }<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0434\u043b\u044f \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a\u0430, \u0441 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u00abaudio\u00bb \u043d\u0430 \u00abvideo\u00bb.<\/p>\n<p>  \u042d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043e\u043d\u043e! \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e! \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u0432\u0430\u0448 \u043f\u043b\u0435\u0435\u0440:<\/p>\n<pre><code class=\"bash\">gcc -o tutorial07 tutorial07.c -lavutil -lavformat -lavcodec -lswscale -lz -lm \\ `sdl-config --cflags --libs`<\/code><\/pre>\n<p>  \u0438 \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0439\u0442\u0435\u0441\u044c \u0432\u0430\u0448\u0438\u043c \u043a\u0438\u043d\u043e\u043f\u043b\u0435\u0435\u0440\u043e\u043c, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u043c \u043c\u0435\u043d\u0435\u0435 \u0447\u0435\u043c \u0437\u0430 1000 \u0441\u0442\u0440\u043e\u043a C!<\/p>\n<p>  \u0425\u043e\u0442\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043a\u0443\u0447\u0430 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c.<a name=\"epilogue\"><\/a><\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435 <a href=\"#seeking\" title=\"\u0423\u0440\u043e\u043a 7: \u041f\u043e\u0438\u0441\u043a\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a> <a href=\"#functions\" title=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 1. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439\">\u2192<\/a><\/h2>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u043b\u0435\u0435\u0440, \u043d\u043e \u043e\u043d, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448, \u043a\u0430\u043a\u0438\u043c \u043c\u043e\u0433 \u0431\u044b \u0431\u044b\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0435\u0449\u0451 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e:<\/p>\n<ul>\n<li>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0430\u0432\u0434\u0435 \u0432 \u0433\u043b\u0430\u0437\u0430, \u044d\u0442\u043e\u0442 \u043f\u043b\u0435\u0435\u0440 \u2014 \u043e\u0442\u0441\u0442\u043e\u0439. \u0422\u0430 \u0432\u0435\u0440\u0441\u0438\u044f ffplay.c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u043e\u0441\u043d\u043e\u0432\u0430\u043d, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0430, \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u044d\u0442\u043e\u0442 \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043a\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 FFmpeg, \u044f \u043d\u0430\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0430\u043c\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e ffplay.c.<\/li>\n<li>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u0443\u0436\u0430\u0441\u043d\u0430 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435.<\/li>\n<li>\u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u043c \u043d\u0430 \u043f\u0430\u0443\u0437\u0443, \u0430 \u044d\u0442\u043e, \u0432\u043d\u0435 \u0432\u0441\u044f\u043a\u0438\u0445 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439, \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <b>paused<\/b> \u0432 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0430\u0443\u0437\u0443. \u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0430\u0443\u0434\u0438\u043e, \u0432\u0438\u0434\u0435\u043e \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c. \u0414\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0435\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <b>av_read_play<\/b>. \u042d\u0442\u043e \u0432\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430 \u0441\u043b\u043e\u0432\u0430\u0445, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e, \u043e\u0442\u043d\u0435\u0441\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u043a \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c\u0443 \u0437\u0430\u0434\u0430\u043d\u0438\u044e. \u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430: \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 ffplay.c.<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0438\u0434\u0435\u043e\u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li>\u041f\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0439 \u043f\u043e\u0438\u0441\u043a. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0435 \u0438\u0441\u043a\u043e\u043c\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u0430 \u043d\u0435 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u0438\u0434\u0435\u043e\u0444\u0430\u0439\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0445 \u043d\u0435\u0441\u043c\u0435\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <b>VOB-\u0444\u0430\u0439\u043b\u044b<\/b>.<\/li>\n<li>\u0421\u0431\u0440\u043e\u0441 \u043a\u0430\u0434\u0440\u0430. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0435\u043e\u0440\u044f\u0434 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442, \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u0430\u0434\u0440\u044b.<\/li>\n<li>\u0421\u0435\u0442\u0435\u0432\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430. \u042d\u0442\u043e\u0442 \u0432\u0438\u0434\u0435\u043e\u043f\u043b\u0435\u0435\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0435 \u0432\u0438\u0434\u0435\u043e.<\/li>\n<li>\u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e, \u0432\u0440\u043e\u0434\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 <b>YUV<\/b>, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u043d\u0435 \u0438\u043c\u0435\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0443\u0433\u0430\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u043b\u0438 <b>time_base<\/b>.<\/li>\n<li>\u041f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c.<\/li>\n<li>\u0412\u0441\u044f\u043a\u043e\u0435-\u043f\u0440\u043e\u0447\u0435\u0435-\u0440\u0430\u0437\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a; \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 ffplay.c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e FFmpeg, \u0442\u043e \u0442\u0443\u0442 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0451. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u0430 <b>output_example.c<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 FFmpeg. \u042f \u043c\u043e\u0433 \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u0443\u0436\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u043d\u043e \u0432\u0440\u044f\u0434 \u043b\u0438 \u043e\u043d \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0434\u0451\u0442 \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e.<\/p>\n<p>  <b>UPD.<\/b> \u0414\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u044f \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b \u044d\u0442\u043e\u0442 \u0442\u0435\u043a\u0441\u0442, \u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043c \u043c\u0438\u0440 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u042d\u0442\u043e\u0442 \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 API; \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0438 \u043a\u043e\u0434. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0445\u043e\u0442\u044f \u044f \u043f\u0440\u043e\u0448\u0451\u043b\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043a\u043e\u0434\u0443 \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0435\u0433\u043e, FFplay \u0432\u0441\u0435 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442 \u044d\u0442\u043e\u0442 \u0438\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0439 \u043f\u043b\u0435\u0435\u0440. \u041f\u043e\u043b\u043e\u0436\u0430 \u0440\u0443\u043a\u0443 \u043d\u0430 \u0441\u0435\u0440\u0434\u0446\u0435, \u043f\u0440\u0438\u0437\u043d\u0430\u0435\u043c: \u0432 \u044d\u0442\u0438\u0445 \u0443\u0440\u043e\u043a\u0430\u0445 \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u043f\u0430\u0440\u0448\u0438\u0432\u044b\u0439 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u043c\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0435\u0433\u043e\u0434\u043d\u044f (\u0438\u043b\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c) \u043f\u043e\u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0443\u0447\u0435\u0431\u043d\u0438\u043a, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 FFplay \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e\u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e, \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044f \u0443\u043f\u0443\u0441\u043a\u0430\u044e \u0435\u0449\u0451 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0432\u0435\u0449\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c FFplay \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u0431\u044b \u043a \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u2014 \u044f \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b.<\/p>\n<p>  \u041d\u043e \u044f \u043e\u0447\u0435\u043d\u044c \u0433\u043e\u0440\u0434 \u0442\u0435\u043c, \u0447\u0442\u043e \u0437\u0430 \u044d\u0442\u0438 \u0433\u043e\u0434\u044b \u043c\u043e\u0439 \u0442\u0440\u0443\u0434 \u043f\u043e\u043c\u043e\u0433 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u0438\u043c, \u0434\u0430\u0436\u0435 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043a\u043e\u0434 \u043b\u044e\u0434\u0438 \u0438\u0441\u043a\u0430\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445. \u042f \u0431\u0435\u0437\u043c\u0435\u0440\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d <a href=\"https:\/\/github.com\/chelyaev\/ffmpeg-tutorial\">\u0427\u0435\u043b\u044f\u0435\u0432\u0443<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0437\u044f\u043b \u043d\u0430 \u0441\u0435\u0431\u044f \u0440\u0443\u0442\u0438\u043d\u0443 \u043f\u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u0432\u0441\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0438 \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440, \u043a\u0430\u043a \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u0443 \u043c\u043e\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044e 8(!) \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434.<\/p>\n<p>  \u0422\u0435\u0448\u0443 \u0441\u0435\u0431\u044f \u043d\u0430\u0434\u0435\u0436\u0434\u043e\u0439, \u0447\u0442\u043e \u044d\u0442\u0438 \u0443\u0440\u043e\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u0438 \u043d\u0435\u0441\u043a\u0443\u0447\u043d\u044b\u043c\u0438. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u0448\u0438\u0431\u043a\u0438, \u0436\u0430\u043b\u043e\u0431\u044b, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438 \u0438 \u0442.\u0434., \u043a\u0430\u0441\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 dranger \u0441\u043e\u0431\u0430\u043a\u0430 gmail \u0434\u043e\u0442 com. \u0418 \u0434\u0430, \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043c\u0435\u043d\u044f \u043f\u043e\u043c\u043e\u0447\u044c \u0441 \u0432\u0430\u0448\u0438\u043c FFmpeg-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0438\u0441\u0435\u043c <i>\u0441\u043b\u0438\u0448\u043a\u043e\u043c<\/i> \u043c\u043d\u043e\u0433\u043e.<a name=\"functions\"><\/a><\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/495614\/\"><img loading=\"lazy\" decoding=\"async\" align=\"right\" width=\"420\" height=\"125\" src=\"https:\/\/habrastorage.org\/webt\/co\/i3\/m0\/coi3m0tliby9r5uxtiydjoeaqkm.png\"><\/a><br clear=\"left\">  <\/p>\n<h4>\u0427\u0438\u0442\u0430\u0439\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0431\u043b\u043e\u0433\u0435\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 EDISON:<\/h4>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/495614\/\"><b>\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e FFmpeg libav<\/b><\/a>  <\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 1. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <a href=\"#epilogue\" title=\"\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a> <a href=\"#data\" title=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 2. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\">\u2192<\/a><\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">int avformat_open_input(AVFormatContext **ptr, const char * filename, AVInputFormat *fmt, AVDictionary **options)<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u044f \u043c\u0435\u0434\u0438\u0430-\u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432 \u0430\u0434\u0440\u0435\u0441\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432 <b>ptr<\/b>.<\/p>\n<p>  <b>fmt<\/b>: \u0435\u0441\u043b\u0438 \u043d\u0435 NULL, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430.<br \/>  <b>buf_size<\/b>: \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e).<br \/>  <b>options<\/b>: AVDictionary \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <b>AVFormatContext<\/b> \u0438 \u0434\u0435\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u043e\u0440\u0430.<\/p>\n<pre><code class=\"cpp\">void avformat_close_input(AVFormatContext **s)<\/code><\/pre>\n<p>  \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0434\u0438\u0430-\u0444\u0430\u0439\u043b. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0434\u0435\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">nt avio_open2 (AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <b>url<\/b>.<\/p>\n<p>  <b>s<\/b>: \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d <b>AVIOContext<\/b>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 NULL.<br \/>  <b>url<\/b>: \u0438\u043c\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<br \/>  <b>flags<\/b>: \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <b>url<\/b>.<br \/>  <b>int_cb<\/b>: \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432.<br \/>  <b>options<\/b>: \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0447\u0430\u0441\u0442\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u041f\u0440\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d \u0438 \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u043d\u0430 dict, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u043f\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c NULL.<\/p>\n<pre><code class=\"cpp\">int av_dup_packet(AVPacket *pkt)<\/code><\/pre>\n<p>  \u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u044d\u0442\u043e \u0445\u0430\u043a: \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043d\u0435 \u0431\u044b\u043b \u0432\u044b\u0434\u0435\u043b\u0435\u043d, \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u044e\u0434\u0430. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0438\u043b\u0438 AVERROR_NOMEM \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u0438.<\/p>\n<pre><code class=\"cpp\">int av_find_stream_info(AVFormatContext *s, AVDictionary **options)<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0449\u0435\u0442 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0442\u043e\u043a\u0435, \u0432\u0440\u043e\u0434\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043a\u0430\u0434\u0440\u043e\u0432. \u042d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432 \u0431\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a MPEG. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 &gt;= 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430, AVERROR_ * \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">AVFrame *avcodec_free_frame()<\/code><\/pre>\n<p>  \u0421\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f av_frame_free. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0432 lavc 55.28.1.<\/p>\n<pre><code class=\"cpp\">void av_frame_free (AVFrame **frame)<\/code><\/pre>\n<p>  \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043a\u0430\u0434\u0440 \u0438 \u043b\u044e\u0431\u044b\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, extended_data.<\/p>\n<pre><code class=\"cpp\">void av_free(void *ptr)<\/code><\/pre>\n<p>  \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e av_malloc() \u0438\u043b\u0438 av_realloc(). \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 ptr == NULL. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c av_freep().<\/p>\n<pre><code class=\"cpp\">void av_freep(void *ptr)<\/code><\/pre>\n<p>  \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 NULL. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 av_free().<\/p>\n<pre><code class=\"cpp\">void av_free_packet(AVPacket *pkt)<\/code><\/pre>\n<p>  \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430 (pkt-&gt;destruct).<\/p>\n<pre><code class=\"cpp\">int64_t av_gettime()<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/p>\n<pre><code class=\"cpp\">void av_init_packet(AVPacket *pkt)<\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u043f\u0430\u043a\u0435\u0442\u0430.<\/p>\n<pre><code class=\"cpp\">void *av_malloc(unsigned int size)<\/code><\/pre>\n<p>  \u0412\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0431\u0430\u0439\u0442\u0430 \u0441 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043f\u0430\u043c\u044f\u0442\u0438 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u0426\u041f). av_malloc(0) \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c.<\/p>\n<pre><code class=\"cpp\">void *av_mallocz(unsigned int size)<\/code><\/pre>\n<p>  \u0422\u043e \u0436\u0435, \u0447\u0442\u043e av_malloc(), \u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cpp\">double av_q2d(AVRational a)<\/code><\/pre>\n<p>  \u0423\u0434\u0432\u0430\u0438\u0432\u0430\u0435\u0442 AVRational.<\/p>\n<pre><code class=\"cpp\">int av_read_frame(AVFormatContext *s, AVPacket *pkt)<\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u0430\u0434\u0440 \u043f\u043e\u0442\u043e\u043a\u0430. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 pkt.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e av_read_frame() \u0438\u043b\u0438 \u0434\u043e av_close_input_file() \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0451\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e av_free_packet. \u0414\u043b\u044f \u0432\u0438\u0434\u0435\u043e \u043f\u0430\u043a\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440. \u0414\u043b\u044f \u0430\u0443\u0434\u0438\u043e \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043a\u0430\u0434\u0440\u043e\u0432, \u0435\u0441\u043b\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0430\u0434\u0440 \u0438\u043c\u0435\u0435\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0430\u043d\u043d\u044b\u0435 PCM \u0438\u043b\u0438 ADPCM). \u0415\u0441\u043b\u0438 \u0430\u0443\u0434\u0438\u043e\u043a\u0430\u0434\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0443\u0434\u0438\u043e MPEG), \u0442\u043e \u043e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440.<\/p>\n<p>  pkt-&gt;pts, pkt-&gt;dts \u0438 pkt-&gt;duration \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 AVStream.timebase (\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0445 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c). pkt-&gt;pts \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c AV_NOPTS_VALUE, \u0435\u0441\u043b\u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0438\u0434\u0435\u043e \u0438\u043c\u0435\u0435\u0442 B-\u043a\u0430\u0434\u0440\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 pkt-&gt;dts, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443.<\/p>\n<p>  <b>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/b> 0, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, &lt; 0, \u0435\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u043b\u0438 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">void av_register_all();<\/code><\/pre>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u043a\u043e\u0434\u0435\u043a\u0438 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<pre><code class=\"cpp\">int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)<\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <b>a<\/b> * <b>bq<\/b> \/ <b>cq<\/b>.<\/p>\n<pre><code class=\"cpp\">int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)<\/code><\/pre>\n<p>  \u0418\u0449\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043a\u0430\u0434\u0440 \u043d\u0430 \u043e\u0442\u043c\u0435\u0442\u043a\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <b>stream_index<\/b>: \u0435\u0441\u043b\u0438 stream_index \u0440\u0430\u0432\u0435\u043d -1, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u0301\u044f \u043c\u0435\u0442\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446 AV_TIME_BASE \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430 time_base.<br \/>  <b>timestamp<\/b>: \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u0301\u044f \u043c\u0435\u0442\u043a\u0430 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c\u0430\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 AVStream.time_base \u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0442\u043e \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 AV_TIME_BASE.<br \/>  <b>flags<\/b>: \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u0441\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430:<br \/>  AVSEEK_FLAG_ANY: \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043a\u0430\u0434\u0440\u0435, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445.<br \/>  AVSEEK_FLAG_BACKWARD: \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<br \/>  AVSEEK_FLAG_BYTE: \u043f\u043e\u0438\u0441\u043a \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<\/p>\n<pre><code class=\"cpp\">AVFrame *avcodec_alloc_frame()<\/code><\/pre>\n<p>  \u0421\u0442\u0430\u0440\u043e\u0435 \u0438\u043c\u044f \u0434\u043b\u044f av_frame_alloc. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u0432 lavc 55.28.1.<\/p>\n<pre><code class=\"cpp\">AVFrame *av_frame_alloc()<\/code><\/pre>\n<p>  \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u0442 AVFrame \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e av_frame_free().<\/p>\n<pre><code class=\"cpp\">int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, const AVPacket *avpkt)<\/code><\/pre>\n<p>  \u0414\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u043a\u0430\u0434\u0440 \u0438\u0437 avpkt \u0432 \u043a\u0430\u0434\u0440. \u0424\u0443\u043d\u043a\u0446\u0438\u044f avcodec_decode_audio4() \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b \u0438\u0437 AVPacket. \u0414\u043b\u044f \u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u0434\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u0432\u044f\u0437\u0430\u043d \u0441 avctx \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e avcodec_open2(). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0434\u0440 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c AVFrame. \u0415\u0441\u043b\u0438 \u043a\u0430\u0434\u0440 \u0431\u044b\u043b \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d, \u043e\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 got_frame_ptr \u0432 1.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/b> \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0444\u0435\u0440, avpkt-&gt;data, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430 FF_INPUT_BUFFER_PADDING_SIZE \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0430\u0439\u0442\u044b \u0447\u0442\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u0435\u043b\u0438 \u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0447\u0438\u0442\u0430\u044e\u0442 32 \u0438\u043b\u0438 64 \u0431\u0438\u0442\u0430 \u0437\u0430 \u0440\u0430\u0437 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e \u043a\u043e\u043d\u0446\u0430.<\/p>\n<p>  <b>avctx<\/b>: \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u0434\u0435\u043a\u0430.<br \/>  <b>frame<\/b>: \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043a\u0430\u0434\u0440.<br \/>  <b>got_frame_ptr<\/b>: \u0446\u0435\u043b\u0435\u0432\u043e\u0439 int, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u0435\u0441\u043b\u0438 \u043a\u0430\u0434\u0440 \u0431\u044b\u043b \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d.<br \/>  <b>AVPKT<\/b>: AVPacket, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0430\u0443\u0434\u0438\u043e.<\/p>\n<p>  <b>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/b> \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e AVPacket.<\/p>\n<pre><code class=\"cpp\">int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *frameFinished, const AVPacket *avpkt)<\/code><\/pre>\n<p>  \u0414\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440 \u0438\u0437 buf \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0424\u0443\u043d\u043a\u0446\u0438\u044f avcodec_decode_video2() \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0434\u0440 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c buf_size. \u0414\u043b\u044f \u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0438\u0434\u0435\u043e\u043a\u043e\u0434\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u0432\u044f\u0437\u0430\u043d \u0441 avctx \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e avcodec_open2(). \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0434\u0440 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/b> \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0431\u0443\u0444\u0435\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a avcodec_decode_audio4, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438 \u043a \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <b>avctx<\/b>: \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u0434\u0435\u043a\u0430.<br \/>  <b>picture<\/b>: AVFrame, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e.<br \/>  <b>frameFinished<\/b>: \u043d\u043e\u043b\u044c, \u0435\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d, \u0438\u043d\u0430\u0447\u0435 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u043b\u044e.<br \/>  <b>avpkt<\/b>: \u0432\u0445\u043e\u0434\u043d\u043e\u0439 AVPacket, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0444\u0435\u0440. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e av_init_packet(), \u0437\u0430\u0442\u0435\u043c, \u0437\u0430\u0434\u0430\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u044f\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a flags&amp;AV_PKT_FLAG_KEY. \u0412\u0441\u0435 \u0434\u0435\u043a\u043e\u0434\u0435\u0440\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  <b>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/b> \u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442\u043e\u0432 \u0438\u043b\u0438 \u043d\u043e\u043b\u044c, \u0435\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d.<\/p>\n<pre><code class=\"cpp\">int64_t av_frame_get_best_effort_timestamp (const AVFrame *frame)<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f best_effort_timestamp \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 AVFrame.<\/p>\n<pre><code class=\"cpp\">AVCodec *avcodec_find_decoder(enum CodecID id)<\/code><\/pre>\n<p>  \u0418\u0449\u0435\u0442 \u0434\u0435\u043a\u043e\u0434\u0435\u0440 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c CodecID. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 NULL \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0433\u043e AVCodecContext \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 AVFormatContext, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f codecCtx-&gt;codec_id.<\/p>\n<pre><code class=\"cpp\">void avcodec_flush_buffers(AVCodecContetx *avctx)<\/code><\/pre>\n<p>  \u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0431\u0443\u0444\u0435\u0440\u0430. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a.<\/p>\n<pre><code class=\"cpp\">AVCodecContext * avcodec_alloc_context3 (const AVCodec *codec)<\/code><\/pre>\n<p>  \u041d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 AVCodecContext \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u043b\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cpp\">int avcodec_copy_context (AVCodecContext *dest, const AVCodecContext *src)<\/code><\/pre>\n<p>  \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e AVCodecContext \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 AVCodecContext. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u0434\u0435\u043a\u0430 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442, \u0442.\u0435. \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c avcodec_open2(), \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 AVCodecContext \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\/\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e\/\u0430\u0443\u0434\u0438\u043e \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <b>dest<\/b>: \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e avcodec_alloc_context3(NULL), \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d.<\/p>\n<pre><code class=\"cpp\">int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)<\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 avctx \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0435\u043a\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <b>codec<\/b>. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 avcodec_find_decoder. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u043e\u043b\u044c \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0445\u0435 \u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code class=\"cpp\">int avpicture_fill(AVPicture *picture, uint8_t *ptr, int pix_fmt, int width, int height)<\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430, \u0441 \u0431\u0443\u0444\u0435\u0440\u043e\u043c <b>ptr<\/b>, \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c <b>pix_fmt<\/b> \u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0448\u0438\u0440\u0438\u043d\u043e\u0439 \u0438 \u0432\u044b\u0441\u043e\u0442\u043e\u0439. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<\/p>\n<pre><code class=\"cpp\">int avpicture_get_size(int pix_fmt, int width, int height)<\/code><\/pre>\n<p>  \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442\u043e\u0432 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b, \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">struct SwsContext* sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)<\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 SwsContext \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 sws_scale.<\/p>\n<p>  <b>srcW<\/b>, <b>srcH<\/b>, <b>srcFormat<\/b>: \u0448\u0438\u0440\u0438\u043d\u0430, \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0441\u043a\u043e\u043c\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<br \/>  <b>dstW<\/b>, <b>dstH<\/b>, <b>dstFormat<\/b>: \u0448\u0438\u0440\u0438\u043d\u0430, \u0432\u044b\u0441\u043e\u0442\u0430 \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<br \/>  <b>flags<\/b>: \u043c\u0435\u0442\u043e\u0434 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<br \/>  \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC, SWS_X, SWS_POINT, SWS_AREA, SWS_BICUBLIN, SWS_GAUSS, SWS_SINC, SWS_LANCZOS, SWS_SPLINE. <br \/>  \u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0444\u043b\u0430\u0433\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0426\u041f: SWS_CPU_CAPS_MMX, SWS_CPU_CAPS_MMX2, SWS_CPU_CAPS_3DNOW, SWS_CPU_CAPS_ALTIVEC.<br \/>  \u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 (\u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b) SWS_FULL_CHR_H_INT, SWS_FULL_CHR_H_INP \u0438 SWS_DIRECT_BGR.<br \/>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0435\u0441\u0442\u044c SWS_ACCURATE_RND \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, SWS_PRINT_INFO.<br \/>  \u042f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435?<br \/>  <b>srcFilter<\/b>, <b>dstFilter<\/b>: SwsFilter \u0434\u043b\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. SwsFilter \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0446\u0432\u0435\u0442\u043d\u043e\u0441\u0442\u0438\/\u044f\u0440\u043a\u043e\u0441\u0442\u0438. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<br \/>  <b>param<\/b>: \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0431\u0443\u0444\u0435\u0440 int[2] \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438. \u041d\u0435 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u041f\u043e\u0445\u043e\u0436\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u043e\u0432!<\/p>\n<pre><code class=\"cpp\">int sws_scale(SwsContext *c, uint8_t *src, int srcStride[], int srcSliceY, int srcSliceH, uint8_t dst[], int dstStride[] sws_scale(sws_ctx, pFrame-&gt;data, pFrame-&gt;linesize, 0, is-&gt;video_st-&gt;codec-&gt;height, pict.data, pict.linesize);<\/code><\/pre>\n<p>  \u041c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 <b>src<\/b> \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c <b>SwsContext*c<\/b>.<br \/>  <b>srcStride<\/b> \u0438 <b>dstStride<\/b> \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param)<\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0443\u044e \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 SDL_AddTimer \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0442\u0430\u0439\u043c\u0435\u0440\u0430. (\u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c, \u0442\u0430\u0439\u043c\u0435\u0440 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0442\u043e\u0439 \u0436\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e.) \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0440\u0430\u0432\u043d\u043e 0, \u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<br \/>  \u0414\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 \u2014 \u0432\u044b\u0437\u0432\u0430\u0442\u044c SDL_RemoveTimer \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0442\u0430\u0439\u043c\u0435\u0440\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0438\u0437 SDL_AddTimer).<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0447\u0435\u043c \u0432\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0441\u0435\u0431\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c SDL_PushEvent.<\/p>\n<p>  \u0421\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 10 \u043c\u0441, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 16 \u043c\u0441, \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0447\u0435\u0440\u0435\u0437 20 \u043c\u0441 \u0432 \u043d\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433, \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043e\u0431 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u0430\u0434\u0440\u043e\u0432 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e 30 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (\u043a\u0430\u0436\u0434\u044b\u0435 33 \u043c\u0441), \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u0439\u043c\u0435\u0440 \u043d\u0430 30 \u043c\u0441 (\u0441\u043c. \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0438\u0436\u0435). \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c SDL_INIT_TIMER \u0432 SDL_Init.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0438\u043b\u0438 NULL, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  \u0424\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430:  <\/p>\n<pre><code class=\"cpp\">Uint32 callback (\u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b Uint32, void * param)<\/code><\/pre>\n<pre><code class=\"cpp\">int SDL_CondSignal(SDL_cond *cond)<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <b>cond<\/b>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0445\u0435 \u0438 -1 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code class=\"cpp\">int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435, \u043f\u043e\u043a\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0435\u0442 SDL_CondSignal \u0438\u043b\u0438 SDL_CondBroadcast \u0434\u043b\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 cond, \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0439\u0442\u0435 \u043c\u044c\u044e\u0442\u0435\u043a\u0441. \u041c\u044c\u044e\u0442\u0435\u043a\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0435\u0440\u0435\u0434 \u0432\u0445\u043e\u0434\u043e\u043c \u0432 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0438\u043b\u0438 -1 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<pre><code class=\"cpp\">SDL_cond *SDL_CreateCond(void);<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0443\u0441\u043b\u043e\u0432\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);<\/code><\/pre>\n<p>  SDL_CreateThread \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0441\u044e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432, \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0438 \u0442.\u0434. \u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>fn<\/b>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 void-\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u041f\u043e\u0442\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 fn \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cpp\">void SDL_Delay (Uint32 \u043c\u0441);<\/code><\/pre>\n<p>  \u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. SDL_Delay \u0431\u0443\u0434\u0435\u0442 \u0436\u0434\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043b\u044c\u0448\u0435 \u0438\u0437-\u0437\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041e\u0421.<br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b> \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 10 \u043c\u0441. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438\u043c\u0435\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0442\u0430\u043a\u0442\u044b, \u043d\u043e \u044d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<pre><code class=\"cpp\">SDL_Overlay *SDL_CreateYUVOverlay(int width, int height, Uint32 format, SDL_Surface *display);<\/code><\/pre>\n<p>  SDL_CreateYUVOverlay \u0441\u043e\u0437\u0434\u0430\u0435\u0442 YUV-\u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b, \u0432\u044b\u0441\u043e\u0442\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 (\u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0441\u043c. \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SDL_Overlay) \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 SDL_Overlay.<\/p>\n<p>  <b>display<\/b> \u0434\u043e\u043b\u0436\u0435\u043d \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u044b\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 SDL_SetVideoMode, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u0422\u0435\u0440\u043c\u0438\u043d \u00ab\u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u0435\u0441\u043b\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e, \u0433\u0434\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">int SDL_LockYUVOverlay(SDL_Overlay *overlay)<\/code><\/pre>\n<p>  SDL_LockYUVOverlay \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0438\u043b\u0438 -1 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">void SDL_UnlockYUVOverlay(SDL_Overlay *overlay)<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect)<\/code><\/pre>\n<p>  \u041f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u0438 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438. SDL_Rect-\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 dstrect \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430. \u0415\u0441\u043b\u0438 dstrect \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u044d\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f 2-\u043a\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430.<\/p>\n<pre><code class=\"cpp\">void SDL_FreeYUVOverlay(SDL_Overlay *overlay)<\/code><\/pre>\n<p>  \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0435 SDL_CreateYUVOverlay.<\/p>\n<pre><code class=\"cpp\">int SDL_Init(Uint32 flags);<\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 SDL. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u0441\u0435\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 SDL-\u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>flags<\/b> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 SDL \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  SDL_INIT_TIMER \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0442\u0430\u0439\u043c\u0435\u0440\u0430.<br \/>  SDL_INIT_AUDIO \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443.<br \/>  SDL_INIT_VIDEO \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443.<br \/>  SDL_INIT_CDROM \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443 CD-ROM.<br \/>  SDL_INIT_JOYSTICK \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a\u0430.<br \/>  SDL_INIT_EVERYTHING \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0451 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435.<br \/>  SDL_INIT_NOPARACHUTE \u2014 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 SDL \u043e\u0442\u043b\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0444\u0430\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<br \/>  SDL_INIT_EVENTTHREAD \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0432\u044b\u0437\u0432\u0430\u0432 SDL_GetError. \u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u0431\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043c\u044b\u0448\u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u0430\u0434\u0440\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c SDL \u0431\u0435\u0437 \u043c\u044b\u0448\u0438, \u043b\u0438\u0431\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b \u00abSDL_NOMOUSE = 1\u00bb \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">SDL_mutex *SDL_CreateMutex(void);<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439, \u043d\u0435\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u044c\u044e\u0442\u0435\u043a\u0441.<\/p>\n<pre><code class=\"cpp\">int SDL_LockMutex(SDL_mutex *mutex)<\/code><\/pre>\n<p>  SDL_LockMutex \u2014 \u044d\u0442\u043e \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c \u0434\u043b\u044f SDL_mutexP. \u041e\u043d \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043c\u044c\u044e\u0442\u0435\u043a\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SDL_CreateMutex. \u0415\u0441\u043b\u0438 \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u0443\u0436\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c, \u0442\u043e SDL_mutexP \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043c \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SDL_mutexV). \u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430 SDL_mutexV (a.k.a. SDL_UnlockMutex) \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u044c\u044e\u0442\u0435\u043a\u0441 \u0432 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0438\u043b\u0438 -1 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">int SDL_UnlockMutex(SDL_Mutex *mutex)<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u0430.<\/p>\n<pre><code class=\"cpp\">int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430, \u043f\u043e\u043c\u0435\u0449\u0430\u044f \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL, \u0430\u0443\u0434\u0438\u043e\u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0431\u0443\u0434\u0443\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u0430\u0443\u0434\u0438\u043e\u0444\u043e\u0440\u043c\u0430\u0442. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u043f\u043e\u0442\u043e\u043a.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 SDL_AudioSpec. \u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c\u0438 \u0430\u0443\u0434\u0438\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  <b>desired-&gt;freq<\/b>: \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0437\u0432\u0443\u043a\u0430 \u0432 \u0441\u044d\u043c\u043f\u043b\u0430\u0445 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<br \/>  <b>desired-&gt;format<\/b>: \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0430\u0443\u0434\u0438\u043e\u0444\u043e\u0440\u043c\u0430\u0442 (\u0441\u043c. SDL_AudioSpec).<br \/>  <b>desired-&gt;channels<\/b>: \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b (1 \u0434\u043b\u044f \u043c\u043e\u043d\u043e, 2 \u0434\u043b\u044f \u0441\u0442\u0435\u0440\u0435\u043e, 4 \u0434\u043b\u044f \u043e\u0431\u044a\u0451\u043c\u043d\u043e\u0433\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u044f, 6 \u0434\u043b\u044f \u043e\u0431\u044a\u0451\u043c\u043d\u043e\u0433\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u044f \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u0432\u043a\u043e\u0439 \u0438 LFE).<br \/>  <b>desired-&gt;samples<\/b>: \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0441\u044d\u043c\u043f\u043b\u0430\u0445. \u042d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u0434\u0432\u043e\u0439\u043a\u0438 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0430\u0443\u0434\u0438\u043e\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u0434\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0434\u043b\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0435\u0431\u043b\u044e\u0442\u0441\u044f \u043e\u0442 512 \u0434\u043e 8192 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u041c\u0435\u043d\u044c\u0448\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442\u043a\u043b\u0438\u043a\u0430, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u044f\u0436\u0451\u043b\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u043e-\u0431\u0443\u0444\u0435\u0440. \u0421\u0442\u0435\u0440\u0435\u043e\u0441\u044d\u043c\u043f\u043b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u0440\u0430\u0432\u043e\u0433\u043e \u0438 \u043b\u0435\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0432 LR-\u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435: <b>ms<\/b> = (<b>samples<\/b> * 1000) \/ <b>freq<\/b>.<br \/>  <b>desired-&gt;callback<\/b>: \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440 \u0438 \u0434\u043b\u0438\u043d\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d\u0430 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u044f SDL_LockAudio \u0438 SDL_UnlockAudio \u0432 \u043a\u043e\u0434\u0435. \u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <nobr><b>void callback<\/b> (<b>void<\/b> * <b>userdata<\/b>, <b>Uint8<\/b> * <b>stream<\/b>, <b>int len<\/b>)<\/nobr>. <b>userdata<\/b> \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 userdata SDL_AudioSpec. <b>stream<\/b> \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u0430 <b>len<\/b> \u2014 \u0434\u043b\u0438\u043d\u0430 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<br \/>  <b>required-&gt;userdata<\/b>: \u044d\u0442\u043e\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>  SDL_OpenAudio \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0438 \u043f\u043e\u043b\u044f \u0438\u0437 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b SDL_AudioSpec, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0430\u0443\u0434\u0438\u043e-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0436\u0435\u043b\u0430\u043d\u0438\u044e. \u041a\u0430\u043a \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0432\u044b\u0448\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0440\u0430\u0432\u0435\u043d NULL, \u0442\u043e SDL \u0441 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0437 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0437\u0432\u0443\u043a\u0430 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f NULL, \u0442\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 SDL_AudioSpec \u2014 \u044d\u0442\u043e \u0432\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 SDL_AudioSpec \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439, \u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 SDL_AudioCVT \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  SDL_OpenAudio \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0442\u0438\u0448\u0438\u043d\u044b \u043a\u0430\u043a \u0434\u043b\u044f \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041f\u043e\u043b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u043e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0430\u0443\u0434\u0438\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a silence \u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u0448\u0438\u043d\u044b \u0432 \u0430\u0443\u0434\u0438\u043e \u0431\u0443\u0444\u0435\u0440\u0435<\/p>\n<p>  \u0417\u0432\u0443\u043a\u043e\u0432\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u0448\u0438\u043d\u044b, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u043e, \u0438 \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u0432\u044b\u0437\u0432\u0430\u0432 SDL_PauseAudio(0), \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0430\u0443\u0434\u0438\u043e. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0430\u0443\u0434\u0438\u043e\u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430, \u043d\u0430\u0434\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0438\u043a\u0448\u0435\u0440\u043d\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<pre><code class=\"cpp\">void SDL_PauseAudio(int pause_on)<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441 pause_on = 0 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0437\u0432\u0443\u043a\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0422\u0438\u0448\u0438\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u0430\u0443\u0434\u0438\u043e\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0430\u0443\u0437\u044b.<\/p>\n<pre><code class=\"cpp\">int SDL_PushEvent(SDL_Event *event)<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043a\u0430\u043a \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043a\u0430\u043d\u0430\u043b \u0441\u0432\u044f\u0437\u0438. \u041d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u044b \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u043d\u0435\u0451 \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 SDL_PushEvent. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u0447\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0438\u043b\u0438 -1, \u0435\u0441\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">int SDL_WaitEvent(SDL_Event *event)<\/code><\/pre>\n<p>  \u041e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f 0, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, 1 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0415\u0441\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e NULL, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/p>\n<pre><code class=\"cpp\">void SDL_Quit()<\/code><\/pre>\n<p>  \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b SDL \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0445\u043e\u0434\u043e\u043c.<\/p>\n<pre><code class=\"cpp\">SDL_Surface *SDL_SetVideoMode(int width, int height, int bitsperpixel, Uint32 flags)<\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u0438\u0434\u0435\u043e\u0440\u0435\u0436\u0438\u043c\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u043e\u0439, \u0432\u044b\u0441\u043e\u0442\u043e\u0439 \u0438 \u0431\u0438\u0442\u0430\u043c\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 SDL 1.2.10, \u0435\u0441\u043b\u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u0440\u0430\u0432\u043d\u044b 0, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0432\u0438\u0434\u0435\u043e (\u0438\u043b\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0441\u0442\u043e\u043b\u0430, \u0435\u0441\u043b\u0438 \u0440\u0435\u0436\u0438\u043c \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d). \u0415\u0441\u043b\u0438 <b>bitsperpixel<\/b> \u0440\u0430\u0432\u0435\u043d 0, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0431\u0438\u0442\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>flags<\/b> \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u043f\u043e\u043b\u0435 flags \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b SDL_Surface. \u0418\u043b\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<p>  SDL_SWSURFACE \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  SDL_HWSURFACE \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  SDL_ASYNCBLIT \u2014 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u043e\u0434\u043d\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 SMP.<br \/>  SDL_ANYFORMAT \u2014 \u043e\u0431\u044b\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0441 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u043c\u0438 \u0431\u0438\u0442\u0430\u043c\u0438 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c (bpp \u2014 \u043e\u0442 bits-per-pixel) \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430, SDL \u0431\u0443\u0434\u0435\u0442 \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0441 \u0437\u0430\u0442\u0435\u043d\u0451\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 SDL_ANYFORMAT \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 SDL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0432\u0438\u0434\u0435\u043e, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0435\u0433\u043e \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445.<br \/>  SDL_HWPALETTE \u2014 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c SDL \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0430\u043b\u0438\u0442\u0440\u0435. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u043b\u0430\u0433\u0430 \u0432\u044b \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0446\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SDL_SetColors \u0438\u043b\u0438 SDL_SetPalette.<br \/>  SDL_DOUBLEBUF \u2014 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0443\u044e \u0434\u0432\u043e\u0439\u043d\u0443\u044e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e; \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 SDL_HWSURFACE. \u0412\u044b\u0437\u043e\u0432 SDL_Flip \u043e\u0431\u0440\u0430\u0442\u0438\u0442 \u0431\u0443\u0444\u0435\u0440\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u044d\u043a\u0440\u0430\u043d. \u0412\u0441\u0451 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u0434\u0432\u043e\u0439\u043d\u0430\u044f \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430, \u0442\u043e SDL_Flip \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 SDL_UpdateRect \u043d\u0430 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d.<br \/>  SDL_FULLSCREEN SDL \u2014 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c. \u0415\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e (\u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435), \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u043e\u043a\u043d\u043e \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u0431\u0443\u0434\u0435\u0442 \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430 \u0447\u0451\u0440\u043d\u043e\u043c \u0444\u043e\u043d\u0435.<br \/>  SDL_OPENGL \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 OpenGL. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u0438\u0434\u0435\u043e OpenGL \u0441 SDL_GL_SetAttribute.<br \/>  SDL_OPENGLBLIT \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 OpenGL, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u043b\u0438\u0442\u0438\u043d\u0433\u0430. \u041f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0430 (2D) \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0430\u043b\u044c\u0444\u0430-\u043a\u0430\u043d\u0430\u043b, \u0438 SDL_UpdateRects \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430. \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0451\u043d \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u043c \u043a\u043e\u0434\u0435.<br \/>  SDL_RESIZABL -\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043a\u043d\u043e \u0441 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c. \u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u043a\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435 SDL_VIDEORESIZE, \u0438 SDL_SetVideoMode \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d \u0441\u043d\u043e\u0432\u0430 \u0441 \u043d\u043e\u0432\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c.<br \/>  SDL_NOFRAME \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, SDL_NOFRAME \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 SDL \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043a\u043d\u043e \u0431\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0438\u043b\u0438 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0440\u0430\u043c\u043a\u0443. \u042d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 SDL_SetVideoMode \u043c\u043e\u0436\u0435\u0442 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u044c, \u043e\u043d\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 flags \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438.<br \/>  \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u0411\u0438\u0442\u043e\u0432\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c 24 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 3 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 4 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c 32. \u041a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0438 15, \u0438 16 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c 2 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c, \u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<br \/>  \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 SDL_SWSURFACE, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043b\u044c\u0444\u0430-\u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043a\u0430\u0434\u0440\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0435 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 (SDL_HWSURFACE), SDL \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0435, \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0445 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0435. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. (\u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c. \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 SDL_FULLSCREEN.) SDL_HWSURFACE \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0431\u043b\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u00abSDL_VIDEO_CENTERED = center\u00bb \u0438\u043b\u0438 \u00abSDL_VIDEO_WINDOW_POS = x, y\u00bb. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 SDL_putenv.<\/p>\n<p>  <b>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/b> \u041f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0434\u0440\u043e\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0438\u043b\u0438 NULL \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f SDL_Quit \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439.<br \/>  \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u042d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b SDL_SetVideoMode (\u0442.\u0435. \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430) \u2014 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<a name=\"data\"><\/a><\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 2. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"#functions\" title=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 1. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a> <a href=\"#links\" title=\"\u0421\u0441\u044b\u043b\u043a\u0438\">\u2192<\/a><\/h2>\n<pre><code class=\"cpp\">AVCodecContext<\/code><\/pre>\n<p>  \u0412\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u0434\u0435\u043a\u0435 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430, \u0438\u0437 AVStream-&gt;codec. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<p>  <b>AVRational<\/b> <b>time_base<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<br \/>  int <b>sample_rate<\/b>: \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<br \/>  int <b>channel<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432<\/p>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a (\u043e\u0447\u0435\u043d\u044c \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439) \u0441\u043c. <a href=\"http:\/\/web.archive.org\/web\/20090410064257\/http:\/\/www.irisa.fr:80\/texmex\/people\/dufouil\/ffmpegdoxy\/structAVCodecContext.html\">\u0437\u0434\u0435\u0441\u044c<\/a> (<i>\u0432\u0435\u0431-\u0430\u0440\u0445\u0438\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0443\u0436\u0435 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430<\/i>). \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u043d\u0435 \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">AVFormatContext<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  const <b>AVClass<\/b> * <b>av_class<\/b><br \/>  <b>AVInputFormat<\/b> * <b>iformat<\/b><br \/>  <b>AVOutputFormat<\/b> * <b>oformat<\/b><br \/>  <b>void<\/b> * <b>priv_data<\/b>:<br \/>  <b>ByteIOContext<\/b> <b>pb<\/b>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c.<br \/>  <b>unsigned int nb_streams<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435.<br \/>  <b>AVStream * streams [MAX_STREAMS]<\/b>: \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c.<br \/>  <b>char filename [1024]:<\/b> \u043d\u0443 \u0430 \u043a\u0430\u043a \u0436\u0435 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e (\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435 \u2014 <i>duh<\/i>).<\/p>\n<p>  \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0444\u0430\u0439\u043b\u0435:<br \/>  int64_t <b>timestamp<\/b>:<br \/>  char <b>title<\/b>[512]:<br \/>  char <b>author<\/b>[512]:<br \/>  char <b>copyright<\/b>[512]:<br \/>  char <b>comment<\/b>[512]:<br \/>  char <b>album<\/b>[512]:<br \/>  int <b>year<\/b>:<br \/>  int <b>track<\/b>:<br \/>  char <b>genre<\/b>[32]:<\/p>\n<p>  int <b>ctx_flags<\/b>:<br \/>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_RAWPICTURE, AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX<br \/>  <b>AVPacketList<\/b> * <b>packet_buffer<\/b>: \u042d\u0442\u043e\u0442 \u0431\u0443\u0444\u0435\u0440 \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u043a\u0435\u0442\u044b \u0443\u0436\u0435 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b, \u043d\u043e \u043d\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u0434\u0435\u043a\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 mpeg.<br \/>  int64_t <b>start_time<\/b>: \u043f\u0440\u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438: \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0432 \u0434\u043e\u043b\u044f\u0445 \u0441\u0435\u043a\u0443\u043d\u0434\u044b AV_TIME_BASE. \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e: \u043e\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 AVStream.<br \/>  <b>int64_t duration: decoding<\/b>: \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u0430, \u0432 \u0434\u043e\u043b\u044f\u0445 AV_TIME_BASE. \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e: \u043e\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 AVStream.<br \/>  <b>int64_t file_size<\/b>: \u043e\u0431\u0449\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430, 0, \u0435\u0441\u043b\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e.<br \/>  <b>int bit_rate<\/b>: \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u043e\u0431\u0449\u0438\u0439 \u0431\u0438\u0442\u0440\u0435\u0439\u0442 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u0431\u0438\u0442\/\u0441, 0, \u0435\u0441\u043b\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0435\u0441\u043b\u0438 file_size \u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432 ffmpeg, \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<br \/>  <b>AVStream * cur_st<\/b><br \/>  <b>const uint8_t * cur_ptr<\/b><br \/>  <b>int cur_len<\/b><br \/>  <b>AVPacket cur_pkt<\/b>:<br \/>  <b>int64_t data_offset<\/b>:<br \/>  <b>int index_built<\/b>: \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430.<br \/>  <b>int mux_rate<\/b>:<br \/>  <b>int packet_size<\/b>:<br \/>  <b>int preload<\/b>:<br \/>  <b>int max_delay<\/b>:<br \/>  <b>int loop_output<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u043a\u043b\u043e\u0432 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445.<br \/>  <b>int flags<\/b>:<br \/>  <b>int loop_input<\/b>:<br \/>  <b>unsigned int probesize<\/b>: \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0446\u0430; \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<br \/>  <b>int max_analyze_duration<\/b>: \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 AV_TIME_BASE, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 av_find_stream_info()<br \/>  <b>const uint8_t * key<\/b>:<br \/>  <b>int keylen<\/b>:<\/p>\n<pre><code class=\"cpp\">AVIOContext<\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c.<\/p>\n<p>  <b>const AVClass * av_class<\/b>: \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<br \/>  <b>unsigned char * buffer<\/b>: \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u0443\u0444\u0435\u0440\u0430.<br \/>  <b>int buffer_size<\/b>: \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430.<br \/>  <b>unsigned char * buf_ptr<\/b>: \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435.<br \/>  <b>unsigned char * buf_end<\/b>: \u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c, \u0447\u0435\u043c buffer + buffer_size, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043e, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443.<br \/>  <b>void * opaque<\/b>: \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c\/\u043f\u043e\u0438\u0441\u043a\/\u2026<br \/>  <b>int(* read_packet )(void *opaque, uint8_t *buf, int buf_size)<\/b>:<br \/>  <b>int(* write_packet )(void *opaque, uint8_t *buf, int buf_size)<\/b>:<br \/>  <b>int64_t(* seek )(void *opaque, int64_t offset, int whence)<\/b>:<br \/>  <b>int64_t pos<\/b>: \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430.<br \/>  <b>int must_flush<\/b>: true, \u0435\u0441\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f.<br \/>  <b>int eof_reached<\/b>: true, \u0435\u0441\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430.<br \/>  <b>int write_flag<\/b>: true, \u0435\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438.<br \/>  <b>int max_packet_size<\/b>:<br \/>  <b>unsigned long checksum<\/b>:<br \/>  <b>unsigned char * checksum_ptr<\/b>:<br \/>  <b>unsigned long(* update_checksum )(unsigned long checksum, const uint8_t *buf, unsigned int size)<\/b>:<br \/>  <b>int error<\/b>: \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 0, \u0435\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e.<br \/>  <b>int(* read_pause )(void *opaque, int pause)<\/b>: \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u043b\u0438 \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443.<br \/>  <b>int64_t(* read_seek )(void *opaque, int stream_index, int64_t timestamp, int flags)<\/b>: \u043f\u043e\u0438\u0441\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c stream_index.<br \/>  <b>int seekable<\/b>: \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0444\u043b\u0430\u0433\u043e\u0432 AVIO_SEEKABLE_ \u0438\u043b\u0438 0, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<br \/>  <b>int64_t maxsize<\/b>: \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0434\u043b\u044f libavformat, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437\u0432\u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d.<br \/>  <b>int direct<\/b>: avio_read \u0438 avio_write \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u0444\u0435\u0440, \u0430 avio_seek \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430.<br \/>  <b>int64_t bytes_read<\/b>: \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0431\u0430\u0439\u0442\u043e\u0432 \u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0434\u043b\u044f libavformat, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437\u0432\u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d.<br \/>  <b>int seek_count<\/b>: \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430. \u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0434\u043b\u044f libavformat, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437\u0432\u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d.<br \/>  <b>int writeout_count<\/b>: \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. \u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0434\u043b\u044f libavformat, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437\u0432\u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d.<br \/>  <b>int orig_buffer_size<\/b>: \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0443\u0444\u0435\u0440\u0430. \u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0434\u043b\u044f libavformat, \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u0438\u0437\u0432\u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d.<\/p>\n<pre><code class=\"cpp\">AVDictionary<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 ffmpeg.<\/p>\n<p>  <b>int count<\/b>:<br \/>  <b>AVDictionaryEntry *elems<\/b>:<\/p>\n<pre><code class=\"cpp\">AVDictionaryEntry<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 AVDictionary.<\/p>\n<p>  <b>char *ket<\/b>:<br \/>  <b>char *value<\/b>:<\/p>\n<pre><code class=\"cpp\">AVFrame<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043a\u043e\u0434\u0435\u043a\u0430 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0435\u0441\u0442\u044c \u043e\u0431\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<p>  <b>uint8_t *data[4]<\/b>:<br \/>  <b>int linesize[4]<\/b>: \u0441\u0442\u0440\u0430\u0439\u0434 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<br \/>  <b>uint8_t *base[4]<\/b>:<br \/>  <b>int key_frame<\/b>:<br \/>  <b>int pict_type<\/b>:<br \/>  <b>int64_t pts<\/b>: \u044d\u0442\u043e \u043d\u0435 \u0442\u0435 pts, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0435 \u043f\u0440\u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<br \/>  <b>int coded_picture_number<\/b>:<br \/>  <b>int display_picture_number<\/b>:<br \/>  <b>int quality<\/b>:<br \/>  <b>int age<\/b>:<br \/>  <b>int reference<\/b>:<br \/>  <b>int8_t *qscale_table<\/b>:<br \/>  <b>int qstride<\/b>:<br \/>  <b>uint8_t *mbskip_table<\/b>:<br \/>  <b>int16_t (*motion_val[2])[2]<\/b>:<br \/>  <b>uint32_t *mb_type<\/b>:<br \/>  <b>uint8_t motion_subsample_log2<\/b>:<br \/>  <b>void *opaque<\/b>: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<br \/>  <b>uint64_t error[4]<\/b>:<br \/>  <b>int type<\/b>:<br \/>  <b>int repeat_pict<\/b>: \u043f\u0440\u0435\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437.<br \/>  <b>int qscale_type<\/b>:<br \/>  <b>int interlaced_frame<\/b>:<br \/>  <b>int top_field_first<\/b>:<br \/>  <b>AVPanScan *pan_scan<\/b>:<br \/>  <b>int palette_has_changed<\/b>:<br \/>  <b>int buffer_hints<\/b>:<br \/>  <b>short *dct_coeff<\/b>:<br \/>  <b>int8_t *ref_index[2]<\/b>:<\/p>\n<pre><code class=\"cpp\">AVPacket<\/code><\/pre>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b avcodec_decode_audio2 \u0438\u043b\u0438 avcodec_decode_video, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u0434\u0440.<\/p>\n<p>  <b>int64_t pts<\/b>: \u043c\u0435\u0442\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 time_base.<br \/>  <b>int64_t dts<\/b>: \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0442\u043a\u0430 \u0434\u0435\u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438 \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 time_base.<br \/>  <b>uint8_t * data<\/b>: \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<br \/>  <b>int size<\/b>: \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <b>int stream_index<\/b>: \u043f\u043e\u0442\u043e\u043a, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u0448\u0435\u043b AVPacket, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432 AVFormatContext.<br \/>  <b>int flags<\/b>: \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 PKT_FLAG_KEY, \u0435\u0441\u043b\u0438 \u043f\u0430\u043a\u0435\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043a\u0430\u0434\u0440\u043e\u043c.<br \/>  <b>int duration<\/b>: \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 time_base (0, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e)<br \/>  <b>void(* destruct )(struct AVPacket *)<\/b>: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e av_destruct_packet).<br \/>  <b>void * priv<\/b>:<br \/>  <b>int64_t pos<\/b>: \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0431\u0430\u0439\u0442\u0430 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435, -1 \u0435\u0441\u043b\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">AVPacketList<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p>  <b>AVPacket pkt<\/b>:<br \/>  <b>AVPacketList * next<\/b>:<\/p>\n<pre><code class=\"cpp\">AVPicture<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 AVFrame, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0451 \u0447\u0430\u0441\u0442\u043e \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442. \u041e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 SWS.<\/p>\n<p>  <b>uint8_t * data [4]<\/b>:<br \/>  <b>int linesize [4]<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<pre><code class=\"cpp\">AVRational<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<\/p>\n<p>  <b>int num<\/b>: \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c.<br \/>  <b>int den<\/b>: \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c.<\/p>\n<pre><code class=\"cpp\">AVStream<\/code><\/pre>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430. \u0412\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0434\u0435\u043a\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<p>  <b>int index<\/b>:<br \/>  <b>int id<\/b>:<br \/>  <b>AVCodecContext * codec<\/b>:<br \/>  <b>AVRational r_frame_rate<\/b>:<br \/>  <b>void * priv_data<\/b>:<br \/>  <b>int64_t codec_info_duration<\/b>:<br \/>  <b>int codec_info_nb_frames<\/b>:<br \/>  <b>AVFrac pts<\/b>:<br \/>  <b>AVRational time_base<\/b>:<br \/>  <b>int pts_wrap_bits<\/b>:<br \/>  <b>int stream_copy<\/b>:<br \/>  <b>enum AVDiscard discard<\/b>: \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d\u044b, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0435\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<br \/>  <b>float quality<\/b>:<br \/>  <b>int64_t start_time<\/b>:<br \/>  <b>int64_t duration<\/b>:<br \/>  <b>char language [4]<\/b>:<br \/>  <b>int need_parsing<\/b>: 1 -&gt; \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433, 2 -&gt; \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043f\u0430\u043a\u043e\u0432\u043a\u0438<br \/>  <b>AVCodecParserContext * parser<\/b>:<br \/>  <b>int64_t cur_dts<\/b>:<br \/>  <b>int last_IP_duration<\/b>:<br \/>  <b>int64_t last_IP_pts<\/b>:<br \/>  <b>AVIndexEntry * index_entries<\/b>:<br \/>  <b>int nb_index_entries<\/b>:<br \/>  <b>unsigned int index_entries_allocated_size<\/b>:<br \/>  <b>int64_t nb_frames<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (\u0435\u0441\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e) \u0438\u043b\u0438 0<br \/>  <b>int64_t pts_buffer [MAX_REORDER_DELAY+1]<\/b>:<\/p>\n<pre><code class=\"cpp\">ByteIOContext<\/code><\/pre>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0430\u0439\u043b\u0435 \u0444\u0438\u043b\u044c\u043c\u0430.<\/p>\n<p>  <b>unsigned char * buffer<\/b>:<br \/>  <b>int buffer_size<\/b>:<br \/>  <b>unsigned char * buf_ptr<\/b>:<br \/>  <b>unsigned char * buf_end<\/b>:<br \/>  <b>void * opaque<\/b>:<br \/>  <b>int(* read_packet )(void *opaque, uint8_t *buf, int buf_size)<\/b>:<br \/>  <b>int(* write_packet )(void *opaque, uint8_t *buf, int buf_size)<\/b>:<br \/>  <b>offset_t(* seek )(void *opaque, offset_t offset, int whence)<\/b>:<br \/>  <b>offset_t pos<\/b>:<br \/>  <b>int must_flush<\/b>:<br \/>  <b>int eof_reached<\/b>:<br \/>  <b>int write_flag<\/b>:<br \/>  <b>int is_streamed<\/b>:<br \/>  <b>int max_packet_size<\/b>:<br \/>  <b>unsigned long checksum<\/b>:<br \/>  <b>unsigned char * checksum_ptr<\/b>:<br \/>  <b>unsigned long(* update_checksum )(unsigned long checksum:<br \/>  const uint8_t *buf, unsigned int size)<\/b>:<br \/>  <b>int error<\/b>: \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 0, \u0435\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e.<\/p>\n<pre><code class=\"cpp\">SDL_AudioSpec<\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u0443\u0434\u0438\u043e\u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <b>freq<\/b>: \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0437\u0432\u0443\u043a\u0430 \u0432 \u0441\u044d\u043c\u043f\u043b\u0430\u0445 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<br \/>  <b>format<\/b>: \u0430\u0443\u0434\u0438\u043e\u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <b>channels<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043d\u0430\u043b\u043e\u0432: 1 \u2014 \u043c\u043e\u043d\u043e, 2 \u2014 \u0441\u0442\u0435\u0440\u0435\u043e, 4 \u043e\u0431\u044a\u0451\u043c\u043d\u044b\u0445, 6 \u043e\u0431\u044a\u0451\u043c\u043d\u044b\u0445 \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u0432\u043a\u043e\u0439 \u0438 LFE<br \/>  <b>silence<\/b>: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044f \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 (\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f).<br \/>  <b>samples<\/b>: \u0440\u0430\u0437\u043c\u0435\u0440 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0441\u044d\u043c\u043f\u043b\u0430\u0445.<br \/>  <b>size<\/b>: \u0420\u0430\u0437\u043c\u0435\u0440 \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 (\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f).<br \/>  <b>callback(..)<\/b>: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u0431\u0443\u0444\u0435\u0440\u0430.<br \/>  <b>userdata<\/b>: \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430:<\/p>\n<p>  AUDIO_U8 \u2014 8-\u0431\u0438\u0442\u043d\u044b\u0435 \u0441\u044d\u043c\u043f\u043b\u044b \u0431\u0435\u0437 \u0437\u043d\u0430\u043a\u0430.<br \/>  AUDIO_S8 \u2014 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 8-\u0431\u0438\u0442\u043d\u044b\u0435 \u0441\u044d\u043c\u043f\u043b\u044b.<br \/>  AUDIO_U16 \u0438\u043b\u0438 AUDIO_U16LSB \u2014 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (\u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442\u043e\u0432).<br \/>  AUDIO_S16 \u0438\u043b\u0438 AUDIO_S16LS \u2014 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432)<br \/>  AUDIO_U16MSB \u2014 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (\u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 big-endian).<br \/>  AUDIO_S16MS \u2014 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 \u0441\u043e \u0441\u0442\u0430\u0440\u0448\u0438\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432).<br \/>  AUDIO_U16SYS: \u043b\u0438\u0431\u043e AUDIO_U16LSB, \u043b\u0438\u0431\u043e AUDIO_U16MSB \u2014 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<br \/>  AUDIO_S16SYS: \u043b\u0438\u0431\u043e AUDIO_S16LSB, \u043b\u0438\u0431\u043e AUDIO_S16MSB \u2014 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430.<\/p>\n<pre><code class=\"cpp\">SDL_Event<\/code><\/pre>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439. <\/p>\n<p>  <b>type<\/b>: \u0442\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<br \/>  <b>active<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 (\u0441\u043c. SDL_ActiveEvent).<br \/>  <b>key<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b (\u0441\u043c. SDL_KeyboardEvent).<br \/>  <b>motion<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u044b\u0448\u0438 (\u0441\u043c. SDL_MouseMotionEvent).<br \/>  <b>button<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043c\u044b\u0448\u0438 (\u0441\u043c. SDL_MouseButtonEvent).<br \/>  <b>jaxis<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043e\u0441\u0438 \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a\u0430 (\u0441\u043c. SDL_JoyAxisEvent).<br \/>  <b>jball<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u043a\u0431\u043e\u043b\u0430 \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a\u0430 (\u0441\u043c. SDL_JoyBallEvent).<br \/>  <b>jhat<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u00ab\u0448\u0430\u043f\u043a\u0438\u00bb \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a\u0430 (\u0441\u043c. SDL_JoyHatEvent).<br \/>  <b>jbutton<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a\u0430 (\u0441\u043c. SDL_JoyButtonEvent).<br \/>  <b>resize<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u043a\u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043c. SDL_ResizeEvent).<br \/>  <b>expose<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043c. SDL_ExposeEvent).<br \/>  <b>quit<\/b>: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043c. SDL_QuitEvent).<br \/>  <b>user<\/b>: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (\u0441\u043c. SDL_UserEvent).<br \/>  <b>syswm<\/b>: \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 \u043e\u043a\u043e\u043d (\u0441\u043c. SDL_SysWMEvent).<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0438\u043f\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0421\u043c. \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e SDL \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<\/p>\n<p>  SDL_ACTIVEEVENT SDL_ActiveEvent<br \/>  SDL_KEYDOWN\/UP SDL_KeyboardEvent<br \/>  SDL_MOUSEMOTION SDL_MouseMotionEvent<br \/>  SDL_MOUSEBUTTONDOWN\/UP SDL_MouseButtonEvent<br \/>  SDL_JOYAXISMOTION SDL_JoyAxisEvent<br \/>  SDL_JOYBALLMOTION SDL_JoyBallEvent<br \/>  SDL_JOYHATMOTION SDL_JoyHatEvent<br \/>  SDL_JOYBUTTONDOWN\/UP SDL_JoyButtonEvent<br \/>  SDL_VIDEORESIZE SDL_ResizeEvent<br \/>  SDL_VIDEOEXPOSE SDL_ExposeEvent<br \/>  SDL_QUIT SDL_QuitEvent<br \/>  SDL_USEREVENT SDL_UserEvent<br \/>  SDL_SYSWMEVENT SDL_SysWMEvent<\/p>\n<pre><code class=\"cpp\">SDL_Overlay<\/code><\/pre>\n<p>  YUV-\u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <b>format<\/b>: \u0444\u043e\u0440\u043c\u0430\u0442 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u043c. \u043d\u0438\u0436\u0435).<br \/>  <b>w, h<\/b>: \u0428\u0438\u0440\u0438\u043d\u0430\/\u0432\u044b\u0441\u043e\u0442\u0430 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  <b>planes<\/b>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u0430\u043d\u043e\u0432 \u0432 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041e\u0431\u044b\u0447\u043d\u043e \u043b\u0438\u0431\u043e 1, \u043b\u0438\u0431\u043e 3.<br \/>  <b>pitches<\/b>: \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043b\u0430\u043d. \u041e\u0442\u0441\u0442\u0443\u043f \u2014 \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445.<br \/>  <b>pixels<\/b>: \u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0430. \u041d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439.<br \/>  <b>hw_overlay<\/b>: \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0440\u0430\u0432\u043d\u043e\u0435 1, \u0435\u0441\u043b\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u043e.<\/p>\n<pre><code class=\"cpp\">SDL_Rect<\/code><\/pre>\n<p>  \u041f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c.<\/p>\n<p>  <b>Sint16 x, y<\/b>: \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043b\u0435\u0432\u043e\u0433\u043e \u0443\u0433\u043b\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<br \/>  <b>Uint16 w, h<\/b>: \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430.<\/p>\n<p>  SDL_Rect \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f SDL_BlitSurface \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0431\u043b\u0438\u0442\u0438\u043d\u0433\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0432\u0438\u0434\u0435\u043e.<\/p>\n<pre><code class=\"cpp\">SDL_Surface<\/code><\/pre>\n<p>  \u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438).<\/p>\n<p>  <b>Uint32 flags<\/b>: \u0424\u043b\u0430\u0433\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0442\u043e\u0442\u0440\u043e\u043d\u044b. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  <b>SDL_PixelFormat *format<\/b>: \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  <b>int w, h<\/b>: \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  <b>Uint16 pitch<\/b>: \u0448\u0430\u0433. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  <b>void *pixels<\/b>: \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438.<br \/>  <b>SDL_Rect clip_rect<\/b>: \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u043a\u043b\u0438\u043f\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  <b>int refcount<\/b>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  SDL_Surface \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u00ab\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439\u00bb \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0430. \u041a\u0430\u0434\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0438\u0434\u0435\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a SDL_Surface \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SDL_SetVideoMode \u0438 SDL_GetVideoSurface. \u041f\u043e\u043b\u044f w \u0438 h \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u0438 \u0432\u044b\u0441\u043e\u0442\u0443 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445. \u041f\u043e\u043b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 (\u0447\u0435\u0440\u0435\u0437 SDL_LockSurface) \u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044e. \u041f\u043e\u043b\u0435 clip_rect \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u043c, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c SDL_SetClipRect.<\/p>\n<p>  \u041f\u043e\u043b\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 OR-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  SDL_SWSURFACE \u2014 \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  SDL_HWSURFACE \u2014 \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  SDL_ASYNCBLIT \u2014 \u0432\u043d\u0435\u0449\u043d\u044f\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0431\u043b\u0438\u043a\u0438, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<br \/>  SDL_ANYFORMAT \u2014 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f).<br \/>  SDL_HWPALETTE \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043b\u0438\u0442\u0440\u0443.<br \/>  SDL_DOUBLEBUF \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0441 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f).<br \/>  SDL_FULLSCREEN \u2014 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f).<br \/>  SDL_OPENGL \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 OpenGL (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f).<br \/>  SDL_OPENGLBLIT \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u043b\u0438\u043d\u0442\u0438\u043d\u0433 OpenGL (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f). \u041f\u0420\u0418\u041c\u0415\u0427\u0410\u041d\u0418\u0415. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<br \/>  SDL_RESIZABLE \u2014 \u0434\u043b\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 (\u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f).<br \/>  SDL_HWACCEL \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u0439 \u0431\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435.<br \/>  SDL_SRCCOLORKEY \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0431\u043b\u0438\u0442\u0442\u0438\u043d\u0433.<br \/>  SDL_RLEACCEL \u2014 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0431\u043b\u0438\u0442\u0442\u0438\u043d\u0433 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RLE.<br \/>  SDL_SRCALPHA \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u044b\u0439 \u0431\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0430\u043b\u044c\u0444\u0430-\u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435.<br \/>  SDL_PREALLOC \u2014 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">SDL_Thread<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0438 \u0432\u0430\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043c. src\/thread\/sdl_thread_c.h \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<pre><code class=\"cpp\">SDL_cond<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0438 \u0432\u0430\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043c. src\/thread\/&lt;system&gt;\/SDL_syscond.c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<pre><code class=\"cpp\">SDL_mutex<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0438 \u0432\u0430\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043c. src\/thread\/&lt;system&gt;\/SDL_sysmutex.c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<a name=\"links\"><\/a><\/p>\n<hr>\n<hr>\n<hr>\n<hr>\n<hr>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438 <a href=\"#data\" title=\"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 2. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\">\u2190<\/a> <a href=\"#menu\" title=\"\u041a \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044e\">\u21d1<\/a><\/h2>\n<p>  <a href=\"http:\/\/dranger.com\/ffmpeg\/\"><img loading=\"lazy\" decoding=\"async\" width=\"122\" height=\"30\" src=\"https:\/\/habrastorage.org\/webt\/ts\/cs\/ro\/tscsrofdmymu7o1rbml2evolway.png\"><\/a> <a href=\"http:\/\/dranger.com\/ffmpeg\/\">An FFmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines<\/a><\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" width=\"30\" height=\"30\" src=\"https:\/\/habrastorage.org\/webt\/3y\/wq\/mh\/3ywqmhuo7fv68jggkc416kbzuw4.png\"> <a href=\"https:\/\/en.wikipedia.org\/wiki\/FFmpeg\">FFmpeg<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Simple_DirectMedia_Layer\">SDL<\/a><\/p>\n<p>  <a href=\"https:\/\/www.ffmpeg.org\/\"><img loading=\"lazy\" decoding=\"async\" width=\"122\" height=\"30\" src=\"https:\/\/habrastorage.org\/webt\/z0\/e1\/6o\/z0e16ozcekig9i8jdthljdqpgga.png\"><\/a> <a href=\"https:\/\/www.ffmpeg.org\/\">FFmpeg HomePage<\/a><\/p>\n<p>  <a href=\"http:\/\/www.libsdl.org\/\"><img loading=\"lazy\" decoding=\"async\" width=\"60\" height=\"30\" src=\"https:\/\/habrastorage.org\/webt\/js\/4n\/23\/js4n231ba7glkow_nud5i3dsveq.png\"> <\/a><a href=\"http:\/\/www.libsdl.org\/\">SDL HomePage<\/a><\/p>\n<hr>\n<p>  <\/p>\n<h3>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u044b \u0432 \u0431\u043b\u043e\u0433\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u042d\u0434\u0438\u0441\u043e\u043d:<\/h3>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td align=\"center\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/498836\/\"><img loading=\"lazy\" decoding=\"async\" width=\"360\" height=\"180\" src=\"https:\/\/habrastorage.org\/webt\/fr\/yz\/q7\/fryzq72v0ik0irt2q4orchflxvs.jpeg\"><\/a><\/td>\n<td align=\"center\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/495612\/\"><img loading=\"lazy\" decoding=\"async\" width=\"360\" height=\"180\" src=\"https:\/\/habrastorage.org\/webt\/jv\/3k\/-f\/jv3k-f5vi9drztohsh-e0t-puru.jpeg\"><\/a><\/td>\n<\/tr>\n<tr>\n<th align=\"center\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/498836\/\">\u0422\u043e\u043f-50 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0444\u0440\u0430\u043d\u0448\u0438\u0437\u0441 \u0434\u043e\u0445\u043e\u0434\u043e\u043c \u0431\u043e\u043b\u0435\u0435 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430<\/a><\/th>\n<th align=\"center\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/495612\/\">\u041f\u0435\u0440\u0435\u0436\u0438\u0432\u0451\u0442 \u043b\u0438 Airbnb \u043a\u043e\u0440\u043e\u043d\u0430\u0432\u0438\u0440\u0443\u0441?[\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u0434\u0430]<\/a><\/th>\n<\/tr>\n<\/table>\n<\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/\"> https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/\"><a href=\"https:\/\/habr.com\/ru\/company\/edison\/blog\/502844\/\"><\/p>\n<div style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"325\" src=\"https:\/\/habrastorage.org\/webt\/yx\/qh\/nq\/yxqhnqwvdlvzfw22erhmpfzpfba.png\"><\/div>\n<p><\/a><br \/>  \u0412\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0433\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0432\u0448\u0435\u0433\u043e \u0441\u0432\u043e\u0435\u0439 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e\u0442 \u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u00ab\u043a\u0443\u0445\u043d\u044e\u00bb \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a FFmpeg \u0438 SDL.<\/p>\n<p>  \u0418 \u0445\u043e\u0442\u044f \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c, \u0432 \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u044a\u0451\u043c\u043d\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u044b <i>\u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430<\/i>. \u0421\u043e\u043e\u0431\u0449\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u0445 (\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445) \u2014 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<a name=\"menu\"><\/a><\/p>\n<h3>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h3>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th align=\"center\"><a href=\"https:\/\/habr.com\/ru\/post\/500402\/\">\u0427\u0430\u0441\u0442\u044c 1<\/a><\/th>\n<th align=\"center\">\u0427\u0430\u0441\u0442\u044c 2<\/th>\n<\/tr>\n<tr>\n<td align=\"left\">\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<br \/>  \u0423\u0440\u043e\u043a 1: \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043d\u043a\u0430\u043f\u0441\u043e\u0432<br \/>  \u0423\u0440\u043e\u043a 2: \u0412\u044b\u0432\u043e\u0434 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d<br \/>  \u0423\u0440\u043e\u043a 3: \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0437\u0432\u0443\u043a\u0430<br \/>  \u0423\u0440\u043e\u043a 4: \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0434\u044b<br \/>  \u0423\u0440\u043e\u043a 5: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e  <\/td>\n<td align=\"left\"><a href=\"https:\/\/habr.com\/ru\/post\/502844\/#audio\">\u0423\u0440\u043e\u043a 6: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#seeking\">\u0423\u0440\u043e\u043a 7: \u041f\u043e\u0438\u0441\u043a<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#epilogue\">\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#functions\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 1. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#data\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 2. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><br \/>  <a href=\"https:\/\/habr.com\/ru\/post\/502844\/#links\">\u0421\u0441\u044b\u043b\u043a\u0438<\/a><\/td>\n<\/tr>\n<\/table>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303906","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303906","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=303906"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303906\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}