FFmpeg: libavdevice/decklink_enc.cpp Source File

FFmpeg
decklink_enc.cpp
Go to the documentation of this file.
1 /*
2  * Blackmagic DeckLink output
3  * Copyright (c) 2013-2014 Ramiro Polla
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include <atomic>
23 using std::atomic;
24 
25 /* Include internal.h first to avoid conflict between winsock.h (used by
26  * DeckLink headers) and winsock2.h (used by libavformat) in MSVC++ builds */
27 extern "C" {
28 #include "libavformat/internal.h"
29 }
30 
31 #include <DeckLinkAPI.h>
32 
33 extern "C" {
34 #include "libavformat/avformat.h"
35 #include "libavutil/imgutils.h"
36 #include "avdevice.h"
37 }
38 
39 #include "decklink_common.h"
40 #include "decklink_enc.h"
41 
42 
43 /* DeckLink callback class declaration */
44  class decklink_frame : public IDeckLinkVideoFrame
45 {
46 public:
47   decklink_frame(struct decklink_ctx *ctx, AVFrame *avframe, AVCodecID codec_id, int height, int width) :
48  _ctx(ctx), _avframe(avframe), _avpacket(NULL), _codec_id(codec_id), _height(height), _width(width), _refs(1) { }
49   decklink_frame(struct decklink_ctx *ctx, AVPacket *avpacket, AVCodecID codec_id, int height, int width) :
50  _ctx(ctx), _avframe(NULL), _avpacket(avpacket), _codec_id(codec_id), _height(height), _width(width), _refs(1) { }
51 
52   virtual long STDMETHODCALLTYPE GetWidth (void) { return _width; }
53   virtual long STDMETHODCALLTYPE GetHeight (void) { return _height; }
54   virtual long STDMETHODCALLTYPE GetRowBytes (void)
55  {
56  if (_codec_id == AV_CODEC_ID_WRAPPED_AVFRAME)
57  return _avframe->linesize[0] < 0 ? -_avframe->linesize[0] : _avframe->linesize[0];
58  else
59  return ((GetWidth() + 47) / 48) * 128;
60  }
61   virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat(void)
62  {
63  if (_codec_id == AV_CODEC_ID_WRAPPED_AVFRAME)
64  return bmdFormat8BitYUV;
65  else
66  return bmdFormat10BitYUV;
67  }
68   virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags (void)
69  {
70  if (_codec_id == AV_CODEC_ID_WRAPPED_AVFRAME)
71  return _avframe->linesize[0] < 0 ? bmdFrameFlagFlipVertical : bmdFrameFlagDefault;
72  else
73  return bmdFrameFlagDefault;
74  }
75 
76   virtual HRESULT STDMETHODCALLTYPE GetBytes (void **buffer)
77  {
78  if (_codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
79  if (_avframe->linesize[0] < 0)
80  *buffer = (void *)(_avframe->data[0] + _avframe->linesize[0] * (_avframe->height - 1));
81  else
82  *buffer = (void *)(_avframe->data[0]);
83  } else {
84  *buffer = (void *)(_avpacket->data);
85  }
86  return S_OK;
87  }
88 
89   virtual HRESULT STDMETHODCALLTYPE GetTimecode (BMDTimecodeFormat format, IDeckLinkTimecode **timecode) { return S_FALSE; }
90   virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary) { return S_FALSE; }
91 
92   virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
93   virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; }
94   virtual ULONG STDMETHODCALLTYPE Release(void)
95  {
96  int ret = --_refs;
97  if (!ret) {
98  av_frame_free(&_avframe);
99  av_packet_free(&_avpacket);
100  delete this;
101  }
102  return ret;
103  }
104 
105   struct decklink_ctx *_ctx;
106   AVFrame *_avframe;
107   AVPacket *_avpacket;
108   AVCodecID _codec_id;
109   int _height;
110   int _width;
111 
112 private:
113   std::atomic<int> _refs;
114 };
115 
116  class decklink_output_callback : public IDeckLinkVideoOutputCallback
117 {
118 public:
119   virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame *_frame, BMDOutputFrameCompletionResult result)
120  {
121  decklink_frame *frame = static_cast<decklink_frame *>(_frame);
122  struct decklink_ctx *ctx = frame->_ctx;
123 
124  if (frame->_avframe)
125  av_frame_unref(frame->_avframe);
126  if (frame->_avpacket)
127  av_packet_unref(frame->_avpacket);
128 
129  pthread_mutex_lock(&ctx->mutex);
130  ctx->frames_buffer_available_spots++;
131  pthread_cond_broadcast(&ctx->cond);
132  pthread_mutex_unlock(&ctx->mutex);
133 
134  return S_OK;
135  }
136   virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped(void) { return S_OK; }
137   virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
138   virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1; }
139   virtual ULONG STDMETHODCALLTYPE Release(void) { return 1; }
140 };
141 
142  static int decklink_setup_video(AVFormatContext *avctx, AVStream *st)
143 {
144  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
145  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
146  AVCodecParameters *c = st->codecpar;
147 
148  if (ctx->video) {
149  av_log(avctx, AV_LOG_ERROR, "Only one video stream is supported!\n");
150  return -1;
151  }
152 
153  if (c->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
154  if (c->format != AV_PIX_FMT_UYVY422) {
155  av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format!"
156  " Only AV_PIX_FMT_UYVY422 is supported.\n");
157  return -1;
158  }
159  } else if (c->codec_id != AV_CODEC_ID_V210) {
160  av_log(avctx, AV_LOG_ERROR, "Unsupported codec type!"
161  " Only V210 and wrapped frame with AV_PIX_FMT_UYVY422 are supported.\n");
162  return -1;
163  }
164 
165  if (ff_decklink_set_format(avctx, c->width, c->height,
166  st->time_base.num, st->time_base.den, c->field_order)) {
167  av_log(avctx, AV_LOG_ERROR, "Unsupported video size, framerate or field order!"
168  " Check available formats with -list_formats 1.\n");
169  return -1;
170  }
171  if (ctx->dlo->EnableVideoOutput(ctx->bmd_mode,
172  bmdVideoOutputFlagDefault) != S_OK) {
173  av_log(avctx, AV_LOG_ERROR, "Could not enable video output!\n");
174  return -1;
175  }
176 
177  /* Set callback. */
178  ctx->output_callback = new decklink_output_callback();
179  ctx->dlo->SetScheduledFrameCompletionCallback(ctx->output_callback);
180 
181  ctx->frames_preroll = st->time_base.den * ctx->preroll;
182  if (st->time_base.den > 1000)
183  ctx->frames_preroll /= 1000;
184 
185  /* Buffer twice as many frames as the preroll. */
186  ctx->frames_buffer = ctx->frames_preroll * 2;
187  ctx->frames_buffer = FFMIN(ctx->frames_buffer, 60);
188  pthread_mutex_init(&ctx->mutex, NULL);
189  pthread_cond_init(&ctx->cond, NULL);
190  ctx->frames_buffer_available_spots = ctx->frames_buffer;
191 
192  /* The device expects the framerate to be fixed. */
193  avpriv_set_pts_info(st, 64, st->time_base.num, st->time_base.den);
194 
195  ctx->video = 1;
196 
197  return 0;
198 }
199 
200  static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st)
201 {
202  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
203  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
204  AVCodecParameters *c = st->codecpar;
205 
206  if (ctx->audio) {
207  av_log(avctx, AV_LOG_ERROR, "Only one audio stream is supported!\n");
208  return -1;
209  }
210  if (c->sample_rate != 48000) {
211  av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate!"
212  " Only 48kHz is supported.\n");
213  return -1;
214  }
215  if (c->channels != 2 && c->channels != 8 && c->channels != 16) {
216  av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels!"
217  " Only 2, 8 or 16 channels are supported.\n");
218  return -1;
219  }
220  if (ctx->dlo->EnableAudioOutput(bmdAudioSampleRate48kHz,
221  bmdAudioSampleType16bitInteger,
222  c->channels,
223  bmdAudioOutputStreamTimestamped) != S_OK) {
224  av_log(avctx, AV_LOG_ERROR, "Could not enable audio output!\n");
225  return -1;
226  }
227  if (ctx->dlo->BeginAudioPreroll() != S_OK) {
228  av_log(avctx, AV_LOG_ERROR, "Could not begin audio preroll!\n");
229  return -1;
230  }
231 
232  /* The device expects the sample rate to be fixed. */
233  avpriv_set_pts_info(st, 64, 1, c->sample_rate);
234  ctx->channels = c->channels;
235 
236  ctx->audio = 1;
237 
238  return 0;
239 }
240 
241  av_cold int ff_decklink_write_trailer(AVFormatContext *avctx)
242 {
243  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
244  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
245 
246  if (ctx->playback_started) {
247  BMDTimeValue actual;
248  ctx->dlo->StopScheduledPlayback(ctx->last_pts * ctx->bmd_tb_num,
249  &actual, ctx->bmd_tb_den);
250  ctx->dlo->DisableVideoOutput();
251  if (ctx->audio)
252  ctx->dlo->DisableAudioOutput();
253  }
254 
255  ff_decklink_cleanup(avctx);
256 
257  if (ctx->output_callback)
258  delete ctx->output_callback;
259 
260  pthread_mutex_destroy(&ctx->mutex);
261  pthread_cond_destroy(&ctx->cond);
262 
263  av_freep(&cctx->ctx);
264 
265  return 0;
266 }
267 
268  static int decklink_write_video_packet(AVFormatContext *avctx, AVPacket *pkt)
269 {
270  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
271  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
272  AVStream *st = avctx->streams[pkt->stream_index];
273  AVFrame *avframe = NULL, *tmp = (AVFrame *)pkt->data;
274  AVPacket *avpacket = NULL;
275  decklink_frame *frame;
276  buffercount_type buffered;
277  HRESULT hr;
278 
279  if (st->codecpar->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
280  if (tmp->format != AV_PIX_FMT_UYVY422 ||
281  tmp->width != ctx->bmd_width ||
282  tmp->height != ctx->bmd_height) {
283  av_log(avctx, AV_LOG_ERROR, "Got a frame with invalid pixel format or dimension.\n");
284  return AVERROR(EINVAL);
285  }
286 
287  avframe = av_frame_clone(tmp);
288  if (!avframe) {
289  av_log(avctx, AV_LOG_ERROR, "Could not clone video frame.\n");
290  return AVERROR(EIO);
291  }
292 
293  frame = new decklink_frame(ctx, avframe, st->codecpar->codec_id, avframe->height, avframe->width);
294  } else {
295  avpacket = av_packet_clone(pkt);
296  if (!avpacket) {
297  av_log(avctx, AV_LOG_ERROR, "Could not clone video frame.\n");
298  return AVERROR(EIO);
299  }
300 
301  frame = new decklink_frame(ctx, avpacket, st->codecpar->codec_id, ctx->bmd_height, ctx->bmd_width);
302  }
303 
304  if (!frame) {
305  av_log(avctx, AV_LOG_ERROR, "Could not create new frame.\n");
306  av_frame_free(&avframe);
307  av_packet_free(&avpacket);
308  return AVERROR(EIO);
309  }
310 
311  /* Always keep at most one second of frames buffered. */
312  pthread_mutex_lock(&ctx->mutex);
313  while (ctx->frames_buffer_available_spots == 0) {
314  pthread_cond_wait(&ctx->cond, &ctx->mutex);
315  }
316  ctx->frames_buffer_available_spots--;
317  pthread_mutex_unlock(&ctx->mutex);
318 
319  /* Schedule frame for playback. */
320  hr = ctx->dlo->ScheduleVideoFrame((struct IDeckLinkVideoFrame *) frame,
321  pkt->pts * ctx->bmd_tb_num,
322  ctx->bmd_tb_num, ctx->bmd_tb_den);
323  /* Pass ownership to DeckLink, or release on failure */
324  frame->Release();
325  if (hr != S_OK) {
326  av_log(avctx, AV_LOG_ERROR, "Could not schedule video frame."
327  " error %08x.\n", (uint32_t) hr);
328  return AVERROR(EIO);
329  }
330 
331  ctx->dlo->GetBufferedVideoFrameCount(&buffered);
332  av_log(avctx, AV_LOG_DEBUG, "Buffered video frames: %d.\n", (int) buffered);
333  if (pkt->pts > 2 && buffered <= 2)
334  av_log(avctx, AV_LOG_WARNING, "There are not enough buffered video frames."
335  " Video may misbehave!\n");
336 
337  /* Preroll video frames. */
338  if (!ctx->playback_started && pkt->pts > ctx->frames_preroll) {
339  av_log(avctx, AV_LOG_DEBUG, "Ending audio preroll.\n");
340  if (ctx->audio && ctx->dlo->EndAudioPreroll() != S_OK) {
341  av_log(avctx, AV_LOG_ERROR, "Could not end audio preroll!\n");
342  return AVERROR(EIO);
343  }
344  av_log(avctx, AV_LOG_DEBUG, "Starting scheduled playback.\n");
345  if (ctx->dlo->StartScheduledPlayback(0, ctx->bmd_tb_den, 1.0) != S_OK) {
346  av_log(avctx, AV_LOG_ERROR, "Could not start scheduled playback!\n");
347  return AVERROR(EIO);
348  }
349  ctx->playback_started = 1;
350  }
351 
352  return 0;
353 }
354 
355  static int decklink_write_audio_packet(AVFormatContext *avctx, AVPacket *pkt)
356 {
357  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
358  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
359  int sample_count = pkt->size / (ctx->channels << 1);
360  buffercount_type buffered;
361 
362  ctx->dlo->GetBufferedAudioSampleFrameCount(&buffered);
363  if (pkt->pts > 1 && !buffered)
364  av_log(avctx, AV_LOG_WARNING, "There's no buffered audio."
365  " Audio will misbehave!\n");
366 
367  if (ctx->dlo->ScheduleAudioSamples(pkt->data, sample_count, pkt->pts,
368  bmdAudioSampleRate48kHz, NULL) != S_OK) {
369  av_log(avctx, AV_LOG_ERROR, "Could not schedule audio samples.\n");
370  return AVERROR(EIO);
371  }
372 
373  return 0;
374 }
375 
376 extern "C" {
377 
378  av_cold int ff_decklink_write_header(AVFormatContext *avctx)
379 {
380  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
381  struct decklink_ctx *ctx;
382  unsigned int n;
383  int ret;
384 
385  ctx = (struct decklink_ctx *) av_mallocz(sizeof(struct decklink_ctx));
386  if (!ctx)
387  return AVERROR(ENOMEM);
388  ctx->list_devices = cctx->list_devices;
389  ctx->list_formats = cctx->list_formats;
390  ctx->preroll = cctx->preroll;
391  cctx->ctx = ctx;
392 
393  /* List available devices and exit. */
394  if (ctx->list_devices) {
395  ff_decklink_list_devices_legacy(avctx, 0, 1);
396  return AVERROR_EXIT;
397  }
398 
399  ret = ff_decklink_init_device(avctx, avctx->filename);
400  if (ret < 0)
401  return ret;
402 
403  /* Get output device. */
404  if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) {
405  av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n",
406  avctx->filename);
407  ret = AVERROR(EIO);
408  goto error;
409  }
410 
411  /* List supported formats. */
412  if (ctx->list_formats) {
413  ff_decklink_list_formats(avctx);
414  ret = AVERROR_EXIT;
415  goto error;
416  }
417 
418  /* Setup streams. */
419  ret = AVERROR(EIO);
420  for (n = 0; n < avctx->nb_streams; n++) {
421  AVStream *st = avctx->streams[n];
422  AVCodecParameters *c = st->codecpar;
423  if (c->codec_type == AVMEDIA_TYPE_AUDIO) {
424  if (decklink_setup_audio(avctx, st))
425  goto error;
426  } else if (c->codec_type == AVMEDIA_TYPE_VIDEO) {
427  if (decklink_setup_video(avctx, st))
428  goto error;
429  } else {
430  av_log(avctx, AV_LOG_ERROR, "Unsupported stream type.\n");
431  goto error;
432  }
433  }
434 
435  return 0;
436 
437 error:
438  ff_decklink_cleanup(avctx);
439  return ret;
440 }
441 
442  int ff_decklink_write_packet(AVFormatContext *avctx, AVPacket *pkt)
443 {
444  struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
445  struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
446  AVStream *st = avctx->streams[pkt->stream_index];
447 
448  ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts);
449 
450  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
451  return decklink_write_video_packet(avctx, pkt);
452  else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
453  return decklink_write_audio_packet(avctx, pkt);
454 
455  return AVERROR(EIO);
456 }
457 
458  int ff_decklink_list_output_devices(AVFormatContext *avctx, struct AVDeviceInfoList *device_list)
459 {
460  return ff_decklink_list_devices(avctx, device_list, 0, 1);
461 }
462 
463 } /* extern "C" */
AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:82
NULL
#define NULL
Definition: coverity.c:32
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: avcodec.h:4233
pthread_mutex_destroy
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: os2threads.h:106
S_OK
#define S_OK
Definition: windows2linux.h:40
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:201
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:61
pthread_cond_wait
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: os2threads.h:164
imgutils.h
misc image utilities
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:4737
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:4152
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVPacket::size
int size
Definition: avcodec.h:1680
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:222
pkt
static AVPacket pkt
Definition: demuxing_decoding.c:54
pthread_cond_destroy
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
Definition: os2threads.h:138
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: avcodec.h:4144
AVFormatContext
Format I/O context.
Definition: avformat.h:1349
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:62
av_cold
#define av_cold
Definition: attributes.h:82
AVCodecParameters::width
int width
Video only.
Definition: avcodec.h:4218
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1417
frame
static AVFrame * frame
Definition: demuxing_decoding.c:53
height
#define height
AVPacket::data
uint8_t * data
Definition: avcodec.h:1679
E_NOINTERFACE
#define E_NOINTERFACE
Definition: windows2linux.h:42
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
avdevice.h
Main libavdevice API header.
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:214
AVFrame::width
int width
Definition: frame.h:259
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
av_packet_clone
AVPacket * av_packet_clone(const AVPacket *src)
Create a new packet that references the same data as src.
Definition: avpacket.c:660
AVERROR
#define AVERROR(e)
Definition: error.h:43
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:163
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:4148
width
uint16_t width
Definition: gdv.c:47
FFMAX
#define FFMAX(a, b)
Definition: common.h:94
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1405
AVFormatContext::filename
char filename[1024]
input or output filename
Definition: avformat.h:1425
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
ctx
AVFormatContext * ctx
Definition: movenc.c:48
pthread_mutex_init
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: os2threads.h:98
n
int n
Definition: avisynth_c.h:684
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:235
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:65
AV_CODEC_ID_WRAPPED_AVFRAME
Passthrough codec, AVFrames wrapped in AVPacket.
Definition: avcodec.h:695
AVERROR_EXIT
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:56
error
static void error(const char *err)
Definition: target_dec_fuzzer.c:59
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:492
AVStream
Stream structure.
Definition: avformat.h:889
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:232
LPVOID
void * LPVOID
Definition: basicDataTypeConversions.h:19
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:618
format
static const char * format
Definition: movenc.c:47
AVDeviceInfoList
List of devices.
Definition: avdevice.h:460
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:505
HRESULT
DWORD HRESULT
Definition: basicDataTypeConversions.h:54
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:215
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: avcodec.h:4262
avformat.h
Main libavformat public API header.
if
if(ret< 0)
Definition: vf_mcdeint.c:279
c
static double c[64]
Definition: vsrc_mptestsrc.c:87
ULONG
uint32_t ULONG
Definition: basicDataTypeConversions.h:60
pthread_cond_init
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Definition: os2threads.h:127
AVRational::den
int den
Denominator.
Definition: rational.h:60
S_FALSE
#define S_FALSE
Definition: windows2linux.h:41
pthread_cond_broadcast
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
Definition: os2threads.h:156
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1377
AVCodecParameters::channels
int channels
Audio only.
Definition: avcodec.h:4258
AVFrame::height
int height
Definition: frame.h:259
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
AVStream::codecpar
AVCodecParameters * codecpar
Definition: avformat.h:1252
AVPacket::stream_index
int stream_index
Definition: avcodec.h:1681
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:926
AVPacket
This structure stores compressed data.
Definition: avcodec.h:1656
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1672
buffer
GLuint buffer
Definition: opengl_enc.c:102
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26

Generated on Fri Jan 12 2018 01:47:53 for FFmpeg by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /