#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <assert.h>
#include <time.h>
#include <sys/shm.h>
#include <errno.h>
#include <pthread.h>
#include "xdvshow-const.h"
#include "xdvshow-shm.h"
#include "xdvshow-flags.h"
#include "xdvshow-defs.h"
Include dependency graph for xdvshow-shm.c:
Go to the source code of this file.
Functions | |
int | xdvshow_semaphore_init () |
xdvshow_semaphore_init() initializes video_ready, video_empty, audio_ready, and audio_empty semaphores. | |
void | xdvshow_close_shm () |
xdvshow_close_shm() detaches shared memory _xdvshow_shm.shm_buf. | |
int | xdvshow_read_unlock () |
xdvshow_read_unlock() decrements (unlocks) video_empty semaphore | |
int | xdvshow_read_audio_unlock () |
xdvshow_read_audio_unlock() decrements (unlocks) audio_empty semaphore | |
int | xdvshow_read_shm (u_char **dvframe) |
returns the video data of the DV frame. | |
int | xdvshow_read_audio_shm (u_char **audioframe) |
returns the audio data of the DV frame. | |
int | _xdvshow_alloc_shm () |
allocates a shared memory segment for video frame buffers list. | |
int | _xdvshow_attach_shm () |
allocates the video and audio buffers within the frame buffers list. | |
Variables | |
u_int32_t | flags |
u_int32_t | dv_format_type |
__xdvshow_shm | _xdvshow_shm |
sem_t | video_ready |
sem_t | video_empty |
sem_t | audio_ready |
sem_t | audio_empty |
|
allocates a shared memory segment for video frame buffers list. Private function.
Definition at line 216 of file xdvshow-shm.c. References _xdvshow_shm, __xdvshow_shm::framebufs, SHM_FRAME_BUF_NUM, and __xdvshow_shm::shmid. Referenced by xdvshow_capture_raw(), xdvshow_prepare_file(), and xdvshow_prepare_rtp().
|
|
allocates the video and audio buffers within the frame buffers list.
Private function. The number of buffers depends on
Definition at line 243 of file xdvshow-shm.c. References _xdvshow_shm, __xdvshow_shm::audio_shm_frame, DVFRAME_READY, __xdvshow_shm::framebufs, shm_frame::next, __xdvshow_shm::read_frame, __xdvshow_shm::shm_buf, __xdvshow_shm::shm_frame, and __xdvshow_shm::shmid. Referenced by xdvshow_capture_raw(), xdvshow_prepare_file(), and xdvshow_prepare_rtp().
|
|
xdvshow_close_shm() detaches shared memory _xdvshow_shm.shm_buf.
Definition at line 98 of file xdvshow-shm.c. References _xdvshow_shm, and __xdvshow_shm::shm_buf. Referenced by main().
|
|
returns the audio data of the DV frame. Waits for the audio_ready semaphore and then points the audioframe pointer to the audio data in the shared memory segment.
Definition at line 185 of file xdvshow-shm.c. References _xdvshow_shm, audio_ready, __xdvshow_shm::audio_shm_frame, audioframe, shm_frame_buf::data, DPRINT, DVFRAME_COPYING, shm_frame::frame_buf, shm_frame_buf::lock, __xdvshow_shm::locked_audio_shm_framebuf, shm_frame::next, and ts_sem_wait. Referenced by main().
|
|
xdvshow_read_audio_unlock() decrements (unlocks) audio_empty semaphore
Definition at line 129 of file xdvshow-shm.c. References _xdvshow_shm, audio_empty, DVFRAME_READY, shm_frame_buf::lock, and __xdvshow_shm::locked_audio_shm_framebuf. Referenced by main().
|
|
returns the video data of the DV frame. Waits for the video_ready semaphore and then points the dvframe pointer to the DV video buffer in the shared memory segment.
Definition at line 151 of file xdvshow-shm.c. References _xdvshow_shm, shm_frame_buf::data, DPRINT, DVFRAME_COPYING, shm_frame::frame_buf, shm_frame_buf::lock, __xdvshow_shm::locked_shm_framebuf, shm_frame::next, __xdvshow_shm::read_frame, ts_sem_wait, and video_ready. Referenced by main().
|
|
xdvshow_read_unlock() decrements (unlocks) video_empty semaphore
Definition at line 111 of file xdvshow-shm.c. References _xdvshow_shm, DVFRAME_READY, shm_frame_buf::lock, __xdvshow_shm::locked_shm_framebuf, and video_empty. Referenced by main().
|
|
xdvshow_semaphore_init() initializes video_ready, video_empty, audio_ready, and audio_empty semaphores. xdvshow_semaphore_init() initializes video_ready, video_empty, audio_ready, and audio_empty semaphores. *_ready semaphores are initialized to 0. *_empty semaphores are initialized to _xdvshow_shm.framebufs value.
Definition at line 74 of file xdvshow-shm.c. References _xdvshow_shm, audio_empty, audio_ready, flags_use_audio, __xdvshow_shm::framebufs, video_empty, and video_ready. Referenced by main().
|
|
|
Definition at line 63 of file xdvshow-shm.c. Referenced by _xdvshow_read_file(), _xdvshow_recv_dvrtp(), xdvshow_read_audio_unlock(), and xdvshow_semaphore_init(). |
|
Definition at line 63 of file xdvshow-shm.c. Referenced by _xdvshow_read_file(), _xdvshow_recv_dvrtp(), xdvshow_read_audio_shm(), and xdvshow_semaphore_init(). |
|
Definition at line 58 of file xdvshow-shm.c. |
|
Definition at line 57 of file xdvshow-shm.c. |
|
Definition at line 62 of file xdvshow-shm.c. Referenced by _xdvshow_read_file(), _xdvshow_recv_dvrtp(), xdvshow_capture_raw(), xdvshow_read_unlock(), and xdvshow_semaphore_init(). |
|
Definition at line 62 of file xdvshow-shm.c. Referenced by _xdvshow_read_file(), _xdvshow_recv_dvrtp(), xdvshow_capture_raw(), xdvshow_read_shm(), and xdvshow_semaphore_init(). |