FS-7500: initial idea to decode video in core

This commit is contained in:
Seven Du
2013-09-25 02:39:29 +08:00
committed by Anthony Minessale
parent 9498f60853
commit 464d18029b
6 changed files with 52 additions and 15 deletions
+12
View File
@@ -134,6 +134,8 @@ struct switch_core_session {
switch_mutex_t *resample_mutex;
switch_mutex_t *codec_read_mutex;
switch_mutex_t *codec_write_mutex;
switch_mutex_t *video_codec_read_mutex;
switch_mutex_t *video_codec_write_mutex;
switch_thread_cond_t *cond;
switch_mutex_t *frame_read_mutex;
@@ -166,6 +168,16 @@ struct switch_core_session {
switch_frame_t enc_read_frame;
uint8_t raw_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
uint8_t enc_read_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
/* video frame.data being trated differently than audio, allocate a dynamic data buffer if necessary*/
switch_buffer_t *video_raw_write_buffer;
switch_frame_t video_raw_write_frame;
// switch_frame_t video_enc_write_frame;
switch_buffer_t *video_raw_read_buffer;
switch_frame_t video_raw_read_frame;
// switch_frame_t video_enc_read_frame;
switch_codec_t bug_codec;
uint32_t read_frame_count;
uint32_t track_duration;
+11
View File
@@ -611,6 +611,13 @@ struct switch_codec_fmtp {
};
struct switch_picture {
uint32_t width; /* the picture width */
uint32_t height; /* the picture height */
uint8_t *planes[4]; /* pointer to the top left pixel for each plane */
uint32_t stride[4]; /* stride between rows for each plane */
};
/*! an abstract handle to a codec module */
struct switch_codec {
/*! the codec interface table this handle uses */
@@ -632,6 +639,10 @@ struct switch_codec {
struct switch_codec *next;
switch_core_session_t *session;
switch_frame_t *cur_frame;
/*! raw picture for encode */
switch_picture_t enc_picture;
/*! decoded picture */
switch_picture_t dec_picture;
};
/*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
+11 -5
View File
@@ -541,6 +541,7 @@ SWITCH_DECLARE_DATA extern switch_filenames SWITCH_GLOBAL_filenames;
#define SWITCH_MAX_SAMPLE_LEN 48
#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
#define SWITCH_RECOMMENDED_BUFFER_SIZE 8192
#define SWITCH_RECOMMENDED_VIDEO_BUFFER_SIZE 4096 * 1024 /* Fixme: Just Make sure it's big enough for now */
#define SWITCH_MAX_CODECS 50
#define SWITCH_MAX_STATE_HANDLERS 30
#define SWITCH_CORE_QUEUE_LEN 100000
@@ -1472,10 +1473,12 @@ typedef enum {
<pre>
SFF_CNG = (1 << 0) - Frame represents comfort noise
SFF_RAW_RTP = (1 << 1) - Frame has raw rtp accessible
SFF_RTP_HEADER = (1 << 2) - Get the rtp header from the frame header
SFF_PLC = (1 << 3) - Frame has generated PLC data
SFF_RFC2833 = (1 << 4) - Frame has rfc2833 dtmf data
SFF_DYNAMIC = (1 << 5) - Frame is dynamic and should be freed
SFF_RTP_HEADER = (1 << 2) - Get the rtp header from the frame header
SFF_PLC = (1 << 3) - Frame has generated PLC data
SFF_RFC2833 = (1 << 4) - Frame has rfc2833 dtmf data
SFF_DYNAMIC = (1 << 5) - Frame is dynamic and should be freed
SFF_MARKER = (1 << 11) - Frame flag has Marker set, only set by encoder
SFF_WAIT_KEY_FRAME = (1 << 12) - Need a key from before could decode
</pre>
*/
typedef enum {
@@ -1490,7 +1493,9 @@ typedef enum {
SFF_ZRTP = (1 << 7),
SFF_UDPTL_PACKET = (1 << 8),
SFF_NOT_AUDIO = (1 << 9),
SFF_RTCP = (1 << 10)
SFF_RTCP = (1 << 10),
SFF_MARKER = (1 << 11),
SFF_WAIT_KEY_FRAME = (1 << 12)
} switch_frame_flag_enum_t;
typedef uint32_t switch_frame_flag_t;
@@ -2090,6 +2095,7 @@ typedef struct switch_caller_extension switch_caller_extension_t;
typedef struct switch_caller_application switch_caller_application_t;
typedef struct switch_state_handler_table switch_state_handler_table_t;
typedef struct switch_timer switch_timer_t;
typedef struct switch_picture switch_picture_t;
typedef struct switch_codec switch_codec_t;
typedef struct switch_core_thread_session switch_core_thread_session_t;
typedef struct switch_codec_implementation switch_codec_implementation_t;