BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJMEDIA Reference

Samples: Playing AVI File to

Video and Sound Devices

This is a very simple example to use the AVI File Player, Sound Device Port, and PJMEDIA_VID_PORT. In this example, we open the file, video, and sound devices, then connect the file to both video and sound devices to play the contents of the file.

This file is pjsip-apps/src/samples/aviplay.c

1 /* $Id: aviplay.c 5535 2017-01-19 10:31:38Z riza $ */
2 /*
3  * Copyright (C) 2010-2011 Teluu Inc. (http://www.teluu.com)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #include <pjmedia.h>
21 #include <pjmedia/converter.h>
22 #include <pjmedia-codec.h>
23 #include <pjlib-util.h>
24 #include <pjlib.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 
28 #include "util.h"
29 
46 /*
47  * aviplay.c
48  *
49  * PURPOSE:
50  * Play a AVI file to video and sound devices.
51  *
52  * USAGE:
53  * aviplay FILE.AVI
54  */
55 
56 
57 #if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
58 
59 
60 /* For logging purpose. */
61 #define THIS_FILE "aviplay.c"
62 
63 static const char *desc =
64 " FILE \n"
65 " \n"
66 " aviplay.c \n"
67 " \n"
68 " PURPOSE \n"
69 " \n"
70 " Demonstrate how to play a AVI file. \n"
71 " \n"
72 " USAGE \n"
73 " \n"
74 " aviplay FILE.AVI \n";
75 
76 struct codec_fmt {
77  pj_uint32_t pjmedia_id;
78  const char *codec_id;
79  /* Do we need to convert the decoded frame? */
80  pj_bool_t need_conversion;
81  /* If conversion is needed, dst_fmt indicates the destination format */
82  pjmedia_format_id dst_fmt;
83 } codec_fmts[] = {{PJMEDIA_FORMAT_MJPEG, "mjpeg",
85  {PJMEDIA_FORMAT_H263 , "h263" ,
86  PJ_FALSE, 0},
87  {PJMEDIA_FORMAT_MPEG4, "mp4v"},
88  {PJMEDIA_FORMAT_H264 , "h264"}
89  };
90 
91 typedef struct avi_port_t
92 {
93  pjmedia_vid_port *vid_port;
94  pjmedia_snd_port *snd_port;
95  pj_bool_t is_running;
96  pj_bool_t is_quitting;
97 } avi_port_t;
98 
99 typedef struct codec_port_data_t
100 {
102  pjmedia_port *src_port;
103  pj_uint8_t *enc_buf;
104  pj_size_t enc_buf_size;
105 
106  pjmedia_converter *conv;
107 } codec_port_data_t;
108 
109 static pj_status_t avi_event_cb(pjmedia_event *event,
110  void *user_data)
111 {
112  avi_port_t *ap = (avi_port_t *)user_data;
113 
114  switch (event->type) {
116  ap->is_quitting = PJ_TRUE;
117  break;
119  if (ap->is_running) {
120  pjmedia_vid_port_stop(ap->vid_port);
121  if (ap->snd_port)
123  pjmedia_snd_port_get_snd_stream(ap->snd_port));
124  } else {
125  pjmedia_vid_port_start(ap->vid_port);
126  if (ap->snd_port)
128  pjmedia_snd_port_get_snd_stream(ap->snd_port));
129  }
130  ap->is_running = !ap->is_running;
131  break;
132  default:
133  return PJ_SUCCESS;
134  }
135 
136  /* We handled the event on our own, so return non-PJ_SUCCESS here */
137  return -1;
138 }
139 
140 static pj_status_t codec_get_frame(pjmedia_port *port,
141  pjmedia_frame *frame)
142 {
143  codec_port_data_t *port_data = (codec_port_data_t*)port->port_data.pdata;
144  pjmedia_vid_codec *codec = port_data->codec;
145  pjmedia_frame enc_frame;
146  pj_status_t status;
147 
148  enc_frame.buf = port_data->enc_buf;
149  enc_frame.size = port_data->enc_buf_size;
150 
151  if (port_data->conv) {
152  pj_size_t frame_size = frame->size;
153 
154  status = pjmedia_port_get_frame(port_data->src_port, frame);
155  if (status != PJ_SUCCESS) goto on_error;
156 
157  status = pjmedia_vid_codec_decode(codec, 1, frame,
158  (unsigned)frame->size, &enc_frame);
159  if (status != PJ_SUCCESS) goto on_error;
160 
161  frame->size = frame_size;
162  status = pjmedia_converter_convert(port_data->conv, &enc_frame, frame);
163  if (status != PJ_SUCCESS) goto on_error;
164 
165  return PJ_SUCCESS;
166  }
167 
168  status = pjmedia_port_get_frame(port_data->src_port, &enc_frame);
169  if (status != PJ_SUCCESS) goto on_error;
170 
171  status = pjmedia_vid_codec_decode(codec, 1, &enc_frame,
172  (unsigned)frame->size, frame);
173  if (status != PJ_SUCCESS) goto on_error;
174 
175  return PJ_SUCCESS;
176 
177 on_error:
178  pj_perror(3, THIS_FILE, status, "codec_get_frame() error");
179  return status;
180 }
181 
182 static int aviplay(pj_pool_t *pool, const char *fname)
183 {
184  pjmedia_vid_port *renderer=NULL;
186  const pjmedia_video_format_info *vfi;
188  pjmedia_snd_port *snd_port = NULL;
189  pj_status_t status;
190  int rc = 0;
191  pjmedia_avi_streams *avi_streams;
192  pjmedia_avi_stream *vid_stream, *aud_stream;
193  pjmedia_port *vid_port = NULL, *aud_port = NULL;
194  pjmedia_vid_codec *codec=NULL;
195  avi_port_t avi_port;
196 
197  pj_bzero(&avi_port, sizeof(avi_port));
198 
199  status = pjmedia_avi_player_create_streams(pool, fname, 0, &avi_streams);
200  if (status != PJ_SUCCESS) {
201  PJ_PERROR(2,("", status, " Error playing %s", fname));
202  rc = 210; goto on_return;
203  }
204 
205  vid_stream = pjmedia_avi_streams_get_stream_by_media(avi_streams,
206  0,
208  vid_port = pjmedia_avi_stream_get_port(vid_stream);
209 
210  if (vid_port) {
212 
213  status = pjmedia_vid_dev_default_param(pool,
215  &param.vidparam);
216  if (status != PJ_SUCCESS) {
217  rc = 220; goto on_return;
218  }
219 
220  /* Create renderer, set it to active */
221  param.active = PJ_TRUE;
224  PJ_TRUE);
226  vid_port->info.fmt.id,
227  vfd->size.w, vfd->size.h,
228  vfd->fps.num, vfd->fps.denum);
229 
232  vid_port->info.fmt.id);
233  /* Check whether the frame is encoded */
234  if (!vfi || vfi->bpp == 0) {
235  /* Yes, prepare codec */
236  pj_str_t codec_id_st;
237  unsigned info_cnt = 1, i, k;
238  const pjmedia_vid_codec_info *codec_info;
239  pj_str_t port_name = {"codec", 5};
240  pj_uint8_t *enc_buf = NULL;
241  pj_size_t enc_buf_size = 0;
242  pjmedia_vid_dev_info rdr_info;
243  pjmedia_port codec_port;
244  codec_port_data_t codec_port_data;
245  pjmedia_vid_codec_param codec_param;
246  struct codec_fmt *codecp = NULL;
247 
248  /* Lookup codec */
249  for (i = 0; i < sizeof(codec_fmts)/sizeof(codec_fmts[0]); i++) {
250  if (vid_port->info.fmt.id == codec_fmts[i].pjmedia_id) {
251  codecp = &codec_fmts[i];
252  break;
253  }
254  }
255  if (!codecp) {
256  rc = 242; goto on_return;
257  }
258  pj_cstr(&codec_id_st, codecp->codec_id);
260  &codec_id_st,
261  &info_cnt,
262  &codec_info,
263  NULL);
264  if (status != PJ_SUCCESS) {
265  rc = 245; goto on_return;
266  }
267  status = pjmedia_vid_codec_mgr_get_default_param(NULL, codec_info,
268  &codec_param);
269  if (status != PJ_SUCCESS) {
270  rc = 246; goto on_return;
271  }
272 
273  pjmedia_format_copy(&codec_param.enc_fmt, &param.vidparam.fmt);
274 
275  pjmedia_vid_dev_get_info(param.vidparam.rend_id, &rdr_info);
276  for (i=0; i<codec_info->dec_fmt_id_cnt; ++i) {
277  for (k=0; k<rdr_info.fmt_cnt; ++k) {
278  if (codec_info->dec_fmt_id[i]==(int)rdr_info.fmt[k].id)
279  {
280  param.vidparam.fmt.id = codec_info->dec_fmt_id[i];
281  i = codec_info->dec_fmt_id_cnt;
282  break;
283  }
284  }
285  }
286 
287  /* Open codec */
288  status = pjmedia_vid_codec_mgr_alloc_codec(NULL, codec_info,
289  &codec);
290  if (status != PJ_SUCCESS) {
291  rc = 250; goto on_return;
292  }
293 
294  status = pjmedia_vid_codec_init(codec, pool);
295  if (status != PJ_SUCCESS) {
296  rc = 251; goto on_return;
297  }
298 
299  pjmedia_format_copy(&codec_param.dec_fmt, &param.vidparam.fmt);
300  codec_param.dir = PJMEDIA_DIR_DECODING;
301  codec_param.packing = PJMEDIA_VID_PACKING_WHOLE;
302  status = pjmedia_vid_codec_open(codec, &codec_param);
303  if (status != PJ_SUCCESS) {
304  rc = 252; goto on_return;
305  }
306 
307  /* Alloc encoding buffer */
308  enc_buf_size = codec_param.dec_fmt.det.vid.size.w *
309  codec_param.dec_fmt.det.vid.size.h * 4
310  + 16; /*< padding, just in case */
311  enc_buf = pj_pool_alloc(pool,enc_buf_size);
312 
313  /* Init codec port */
314  pj_bzero(&codec_port, sizeof(codec_port));
315  status = pjmedia_port_info_init2(&codec_port.info, &port_name,
316  0x1234,
318  &codec_param.dec_fmt);
319  if (status != PJ_SUCCESS) {
320  rc = 260; goto on_return;
321  }
322  pj_bzero(&codec_port_data, sizeof(codec_port_data));
323  codec_port_data.codec = codec;
324  codec_port_data.src_port = vid_port;
325  codec_port_data.enc_buf = enc_buf;
326  codec_port_data.enc_buf_size = enc_buf_size;
327 
328  codec_port.get_frame = &codec_get_frame;
329  codec_port.port_data.pdata = &codec_port_data;
330 
331  /* Check whether we need to convert the decoded frame */
332  if (codecp->need_conversion) {
333  pjmedia_conversion_param conv_param;
334 
335  pjmedia_format_copy(&conv_param.src, &param.vidparam.fmt);
336  pjmedia_format_copy(&conv_param.dst, &param.vidparam.fmt);
337  conv_param.dst.id = codecp->dst_fmt;
338  param.vidparam.fmt.id = conv_param.dst.id;
339 
340  status = pjmedia_converter_create(NULL, pool, &conv_param,
341  &codec_port_data.conv);
342  if (status != PJ_SUCCESS) {
343  rc = 270; goto on_return;
344  }
345  }
346 
347  status = pjmedia_vid_port_create(pool, &param, &renderer);
348  if (status != PJ_SUCCESS) {
349  rc = 230; goto on_return;
350  }
351 
352  status = pjmedia_vid_port_connect(renderer, &codec_port,
353  PJ_FALSE);
354  } else {
355  status = pjmedia_vid_port_create(pool, &param, &renderer);
356  if (status != PJ_SUCCESS) {
357  rc = 230; goto on_return;
358  }
359 
360  /* Connect avi port to renderer */
361  status = pjmedia_vid_port_connect(renderer, vid_port,
362  PJ_FALSE);
363  }
364 
365  if (status != PJ_SUCCESS) {
366  rc = 240; goto on_return;
367  }
368  }
369 
370  aud_stream = pjmedia_avi_streams_get_stream_by_media(avi_streams,
371  0,
373  aud_port = pjmedia_avi_stream_get_port(aud_stream);
374 
375  if (aud_port) {
376  /* Create sound player port. */
378  pool, /* pool */
379  -1, /* use default dev. */
380  PJMEDIA_PIA_SRATE(&aud_port->info),/* clock rate. */
381  PJMEDIA_PIA_CCNT(&aud_port->info), /* # of channels. */
382  PJMEDIA_PIA_SPF(&aud_port->info), /* samples per frame. */
383  PJMEDIA_PIA_BITS(&aud_port->info), /* bits per sample. */
384  0, /* options */
385  &snd_port /* returned port */
386  );
387  if (status != PJ_SUCCESS) {
388  rc = 310; goto on_return;
389  }
390 
391  /* Connect file port to the sound player.
392  * Stream playing will commence immediately.
393  */
394  status = pjmedia_snd_port_connect(snd_port, aud_port);
395  if (status != PJ_SUCCESS) {
396  rc = 330; goto on_return;
397  }
398  }
399 
400  if (vid_port) {
402 
403  pj_bzero(&cb, sizeof(cb));
404  avi_port.snd_port = snd_port;
405  avi_port.vid_port = renderer;
406  avi_port.is_running = PJ_TRUE;
407  pjmedia_vid_port_set_cb(renderer, &cb, &avi_port);
408 
409  /* subscribe events */
410  pjmedia_event_subscribe(NULL, &avi_event_cb, &avi_port,
411  renderer);
412 
413  if (snd_port) {
414  /* Synchronize video rendering and audio playback */
416  renderer,
418  snd_port, PJMEDIA_DIR_PLAYBACK));
419  }
420 
421 
422  /* Start video streaming.. */
423  status = pjmedia_vid_port_start(renderer);
424  if (status != PJ_SUCCESS) {
425  rc = 270; goto on_return;
426  }
427  }
428 
429  while (!avi_port.is_quitting) {
430  pj_thread_sleep(100);
431  }
432 
433 on_return:
434  if (snd_port) {
435  pjmedia_snd_port_disconnect(snd_port);
436  /* Without this sleep, Windows/DirectSound will repeteadly
437  * play the last frame during destroy.
438  */
439  pj_thread_sleep(100);
440  pjmedia_snd_port_destroy(snd_port);
441  }
442  if (renderer) {
443  pjmedia_event_unsubscribe(NULL, &avi_event_cb, &avi_port,
444  renderer);
445  pjmedia_vid_port_destroy(renderer);
446  }
447  if (aud_port)
448  pjmedia_port_destroy(aud_port);
449  if (vid_port)
450  pjmedia_port_destroy(vid_port);
451  if (codec) {
454  }
455 
456  return rc;
457 }
458 
459 
460 static int main_func(int argc, char *argv[])
461 {
462  pj_caching_pool cp;
463  pj_pool_t *pool;
464  int rc = 0;
465  pj_status_t status = PJ_SUCCESS;
466 
467  if (argc != 2) {
468  puts("Error: filename required");
469  puts(desc);
470  return 110;
471  }
472 
473 
474  /* Must init PJLIB first: */
475  status = pj_init();
476  PJ_ASSERT_RETURN(status == PJ_SUCCESS, 120);
477 
478  /* Must create a pool factory before we can allocate any memory. */
480 
481  /* Create memory pool for our file player */
482  pool = pj_pool_create( &cp.factory, /* pool factory */
483  "AVI", /* pool name. */
484  4000, /* init size */
485  4000, /* increment size */
486  NULL /* callback on error */
487  );
488 
489  pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
490  pjmedia_converter_mgr_create(pool, NULL);
491  pjmedia_event_mgr_create(pool, 0, NULL);
492  pjmedia_vid_codec_mgr_create(pool, NULL);
493 
494  status = pjmedia_vid_dev_subsys_init(&cp.factory);
495  if (status != PJ_SUCCESS) {
496  rc = 130;
497  goto on_return;
498  }
499 
500  status = pjmedia_aud_subsys_init(&cp.factory);
501  if (status != PJ_SUCCESS) {
502  rc = 140;
503  goto on_return;
504  }
505 
506 #if defined(PJMEDIA_HAS_OPENH264_CODEC) && PJMEDIA_HAS_OPENH264_CODEC != 0
507  status = pjmedia_codec_openh264_vid_init(NULL, &cp.factory);
508  if (status != PJ_SUCCESS) {
509  rc = 150;
510  goto on_return;
511  }
512 #endif
513 
514 #if PJMEDIA_HAS_FFMPEG_VID_CODEC
515  status = pjmedia_codec_ffmpeg_vid_init(NULL, &cp.factory);
516  if (status != PJ_SUCCESS) {
517  rc = 160;
518  goto on_return;
519  }
520 #endif
521 
522  rc = aviplay(pool, argv[1]);
523 
524  /*
525  * File should be playing and looping now
526  */
527 
528  /* Without this sleep, Windows/DirectSound will repeteadly
529  * play the last frame during destroy.
530  */
531  pj_thread_sleep(100);
532 
533 on_return:
534 #if PJMEDIA_HAS_FFMPEG_VID_CODEC
536 #endif
537 #if defined(PJMEDIA_HAS_OPENH264_CODEC) && PJMEDIA_HAS_OPENH264_CODEC != 0
539 #endif
542 
547 
548  /* Release application pool */
549  pj_pool_release( pool );
550 
551  /* Destroy pool factory */
553 
554  /* Shutdown PJLIB */
555  pj_shutdown();
556 
557  /* Done. */
558  return rc;
559 }
560 
561 int main(int argc, char *argv[])
562 {
563  return pj_run_app(&main_func, argc, argv, 0);
564 }
565 
566 #else
567 
568 int main(int argc, char *argv[])
569 {
570  PJ_UNUSED_ARG(argc);
571  PJ_UNUSED_ARG(argv);
572  puts("Error: this sample requires video capability (PJMEDIA_HAS_VIDEO == 1)");
573  return -1;
574 }
575 
576 #endif /* PJMEDIA_HAS_VIDEO */
pj_status_t pjmedia_vid_codec_mgr_alloc_codec(pjmedia_vid_codec_mgr *mgr, const pjmedia_vid_codec_info *info, pjmedia_vid_codec **p_codec)
void pjmedia_format_init_video(pjmedia_format *fmt, pj_uint32_t fmt_id, unsigned width, unsigned height, unsigned fps_num, unsigned fps_denum)
PJMEDIA main header file.
pjmedia_clock_src * pjmedia_snd_port_get_clock_src(pjmedia_snd_port *snd_port, pjmedia_dir dir)
pj_status_t pjmedia_vid_codec_mgr_find_codecs_by_id(pjmedia_vid_codec_mgr *mgr, const pj_str_t *codec_id, unsigned *count, const pjmedia_vid_codec_info *p_info[], unsigned prio[])
#define PJ_ASSERT_RETURN(expr, retval)
pj_status_t pjmedia_vid_codec_mgr_dealloc_codec(pjmedia_vid_codec_mgr *mgr, pjmedia_vid_codec *codec)
pj_status_t pjmedia_port_get_frame(pjmedia_port *port, pjmedia_frame *frame)
pj_size_t size
Definition: frame.h:60
Format conversion utilities.
pjmedia_port_info info
Definition: port.h:366
pj_status_t pjmedia_aud_stream_stop(pjmedia_aud_stream *strm)
Definition: videodev.h:288
void pj_pool_release(pj_pool_t *pool)
pj_status_t pjmedia_aud_subsys_init(pj_pool_factory *pf)
pjmedia_format_id dec_fmt_id[8]
Definition: vid_codec.h:124
pjmedia_format fmt
Definition: port.h:234
int pj_bool_t
pjmedia_format * pjmedia_format_copy(pjmedia_format *dst, const pjmedia_format *src)
pj_status_t pjmedia_vid_codec_init(pjmedia_vid_codec *codec, pj_pool_t *pool)
Definition: vid_codec.h:668
pj_status_t pjmedia_vid_codec_open(pjmedia_vid_codec *codec, pjmedia_vid_codec_param *param)
Definition: vid_codec.h:687
pj_uint8_t bpp
Definition: format.h:422
Definition: confbench.c:135
pjmedia_vid_packing packing
Definition: vid_codec.h:151
pjmedia_vid_codec_mgr * pjmedia_vid_codec_mgr_instance(void)
int denum
Definition: types.h:219
unsigned fmt_cnt
Definition: videodev.h:318
void pjmedia_vid_port_param_default(pjmedia_vid_port_param *prm)
pj_status_t pjmedia_port_destroy(pjmedia_port *port)
unsigned h
Definition: types.h:237
Definition: types.h:170
pj_status_t pjmedia_event_unsubscribe(pjmedia_event_mgr *mgr, pjmedia_event_cb *cb, void *user_data, void *epub)
pjmedia_ratio fps
Definition: format.h:265
const pjmedia_video_format_info * pjmedia_get_video_format_info(pjmedia_video_format_mgr *mgr, pj_uint32_t id)
pj_status_t pjmedia_snd_port_destroy(pjmedia_snd_port *snd_port)
struct pjmedia_vid_port pjmedia_vid_port
Definition: vid_port.h:69
Definition: types.h:60
pjmedia_converter_mgr * pjmedia_converter_mgr_instance(void)
pjmedia_format_id
Definition: format.h:55
pj_status_t pjmedia_video_format_mgr_create(pj_pool_t *pool, unsigned max_fmt, unsigned options, pjmedia_video_format_mgr **p_mgr)
pjmedia_rect_size size
Definition: format.h:264
Definition: converter.h:115
pjmedia_event_type type
Definition: event.h:168
#define PJ_PERROR(level, arg)
pj_status_t pjmedia_aud_subsys_shutdown(void)
pjmedia_format src
Definition: converter.h:49
struct pjmedia_snd_port pjmedia_snd_port
Definition: sound_port.h:145
int pj_status_t
pj_status_t pjmedia_vid_dev_subsys_shutdown(void)
pjmedia_vid_dev_param vidparam
Definition: vid_port.h:47
pj_pool_factory_policy pj_pool_factory_default_policy
void * pj_pool_alloc(pj_pool_t *pool, pj_size_t size)
pj_status_t pjmedia_converter_mgr_create(pj_pool_t *pool, pjmedia_converter_mgr **mgr)
pj_status_t pjmedia_event_mgr_create(pj_pool_t *pool, unsigned options, pjmedia_event_mgr **mgr)
Definition: types.h:158
Definition: types.h:164
pj_status_t pjmedia_vid_codec_mgr_create(pj_pool_t *pool, pjmedia_vid_codec_mgr **mgr)
pj_status_t pjmedia_vid_port_set_clock_src(pjmedia_vid_port *vid_port, pjmedia_clock_src *clocksrc)
Definition: port.h:364
unsigned int pj_uint32_t
Definition: event.h:70
pj_status_t pjmedia_vid_codec_decode(pjmedia_vid_codec *codec, pj_size_t pkt_count, pjmedia_frame packets[], unsigned out_size, pjmedia_frame *output)
Definition: vid_codec.h:826
pj_pool_factory factory
pj_status_t pjmedia_vid_port_connect(pjmedia_vid_port *vid_port, pjmedia_port *port, pj_bool_t destroy)
void pjmedia_event_mgr_destroy(pjmedia_event_mgr *mgr)
pjmedia_video_format_detail vid
Definition: format.h:316
pj_status_t pjmedia_vid_port_stop(pjmedia_vid_port *vid_port)
Include all codecs API in PJMEDIA-CODEC.
pj_status_t pjmedia_vid_codec_mgr_destroy(pjmedia_vid_codec_mgr *mgr)
pj_status_t pjmedia_converter_create(pjmedia_converter_mgr *mgr, pj_pool_t *pool, pjmedia_conversion_param *param, pjmedia_converter **p_cv)
PJ_TRUE
pjmedia_format dec_fmt
Definition: vid_codec.h:157
pj_status_t(* get_frame)(struct pjmedia_port *this_port, pjmedia_frame *frame)
Definition: port.h:394
unsigned PJMEDIA_PIA_CCNT(const pjmedia_port_info *pia)
Definition: port.h:257
pj_status_t pjmedia_codec_ffmpeg_vid_init(pjmedia_vid_codec_mgr *mgr, pj_pool_factory *pf)
void pj_perror(int log_level, const char *sender, pj_status_t status, const char *title_fmt,...)
unsigned dec_fmt_id_cnt
Definition: vid_codec.h:122
pj_status_t pjmedia_converter_convert(pjmedia_converter *cv, pjmedia_frame *src_frame, pjmedia_frame *dst_frame)
pjmedia_format fmt[PJMEDIA_VID_DEV_INFO_FMT_CNT]
Definition: videodev.h:326
pjmedia_format enc_fmt
Definition: vid_codec.h:153
Definition: converter.h:47
pj_status_t pjmedia_vid_port_start(pjmedia_vid_port *vid_port)
pj_status_t pjmedia_vid_dev_default_param(pj_pool_t *pool, pjmedia_vid_dev_index id, pjmedia_vid_dev_param *param)
void pj_caching_pool_init(pj_caching_pool *ch_pool, const pj_pool_factory_policy *policy, pj_size_t max_capacity)
void * buf
Definition: frame.h:59
pj_status_t pjmedia_snd_port_create_player(pj_pool_t *pool, int index, unsigned clock_rate, unsigned channel_count, unsigned samples_per_frame, unsigned bits_per_sample, unsigned options, pjmedia_snd_port **p_port)
void pj_bzero(void *dst, pj_size_t size)
const pj_str_t * pj_cstr(pj_str_t *str, const char *s)
void pjmedia_vid_port_set_cb(pjmedia_vid_port *vid_port, const pjmedia_vid_dev_cb *cb, void *user_data)
Definition: event.h:60
pj_status_t pjmedia_codec_openh264_vid_deinit(void)
unsigned char pj_uint8_t
pj_status_t pjmedia_vid_dev_subsys_init(pj_pool_factory *pf)
pjmedia_avi_stream * pjmedia_avi_streams_get_stream_by_media(pjmedia_avi_streams *streams, unsigned start_idx, pjmedia_type media_type)
void pjmedia_vid_port_destroy(pjmedia_vid_port *vid_port)
Definition: types.h:167
Definition: vid_port.h:42
void pjmedia_video_format_mgr_destroy(pjmedia_video_format_mgr *mgr)
int pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[], unsigned flags)
Definition: event.h:163
pj_status_t pjmedia_vid_codec_close(pjmedia_vid_codec *codec)
Definition: vid_codec.h:702
Definition: format.h:262
Definition: vid_codec.h:148
unsigned w
Definition: types.h:236
pj_status_t pjmedia_avi_player_create_streams(pj_pool_t *pool, const char *filename, unsigned flags, pjmedia_avi_streams **p_streams)
Definition: vid_codec.h:271
unsigned PJMEDIA_PIA_SPF(const pjmedia_port_info *pia)
Definition: port.h:298
void pjmedia_converter_mgr_destroy(pjmedia_converter_mgr *mgr)
Definition: vid_codec.h:75
pjmedia_event_mgr * pjmedia_event_mgr_instance(void)
union pjmedia_format::@4 det
pj_status_t pjmedia_snd_port_connect(pjmedia_snd_port *snd_port, pjmedia_port *port)
pj_bool_t active
Definition: vid_port.h:62
Definition: videodev.h:157
pj_uint32_t id
Definition: format.h:291
pj_pool_t * pj_pool_create(pj_pool_factory *factory, const char *name, pj_size_t initial_size, pj_size_t increment_size, pj_pool_callback *callback)
Definition: format.h:164
pj_status_t pjmedia_snd_port_disconnect(pjmedia_snd_port *snd_port)
pjmedia_port * pjmedia_avi_stream_get_port(pjmedia_avi_stream *stream)
Definition: avi_stream.h:125
unsigned PJMEDIA_PIA_SRATE(const pjmedia_port_info *pia)
Definition: port.h:244
void * pdata
Definition: port.h:372
Definition: vid_codec.h:114
unsigned PJMEDIA_PIA_BITS(const pjmedia_port_info *pia)
Definition: port.h:270
void pj_shutdown(void)
Definition: frame.h:56
Definition: siprtp.c:101
pjmedia_video_format_detail * pjmedia_format_get_video_format_detail(const pjmedia_format *fmt, pj_bool_t assert_valid)
pj_status_t pjmedia_event_subscribe(pjmedia_event_mgr *mgr, pjmedia_event_cb *cb, void *user_data, void *epub)
pj_status_t pjmedia_vid_codec_mgr_get_default_param(pjmedia_vid_codec_mgr *mgr, const pjmedia_vid_codec_info *info, pjmedia_vid_codec_param *param)
pjmedia_video_format_mgr * pjmedia_video_format_mgr_instance(void)
pj_status_t pj_thread_sleep(unsigned msec)
Definition: types.h:63
pjmedia_format dst
Definition: converter.h:50
pjmedia_dir dir
Definition: videodev.h:385
pj_status_t pjmedia_port_info_init2(pjmedia_port_info *info, const pj_str_t *name, unsigned signature, pjmedia_dir dir, const pjmedia_format *fmt)
Definition: videodev.h:334
pj_status_t pjmedia_codec_openh264_vid_init(pjmedia_vid_codec_mgr *mgr, pj_pool_factory *pf)
PJ_SUCCESS
struct pjmedia_avi_streams pjmedia_avi_streams
Definition: avi_stream.h:61
pjmedia_format fmt
Definition: videodev.h:420
pj_status_t pjmedia_vid_port_create(pj_pool_t *pool, const pjmedia_vid_port_param *prm, pjmedia_vid_port **p_vp)
pjmedia_vid_dev_index rend_id
Definition: videodev.h:397
pj_status_t pj_init(void)
size_t pj_size_t
PJ_FALSE
pj_status_t pjmedia_aud_stream_start(pjmedia_aud_stream *strm)
#define PJ_UNUSED_ARG(arg)
pj_status_t pjmedia_vid_dev_get_info(pjmedia_vid_dev_index id, pjmedia_vid_dev_info *info)
Definition: format.h:400
pj_status_t pjmedia_codec_ffmpeg_vid_deinit(void)
pjmedia_dir dir
Definition: vid_codec.h:150
pjmedia_aud_stream * pjmedia_snd_port_get_snd_stream(pjmedia_snd_port *snd_port)
void pj_caching_pool_destroy(pj_caching_pool *ch_pool)

 


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.