⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codec_plugin.h

📁 完整的RTP RTSP代码库
💻 H
📖 第 1 页 / 共 2 页
字号:
 * Returns - must return a handle that contains codec_data_t. */typedef codec_data_t *(*vc_create_f)(const char *stream_type,				     const char *compressor, 				     int type, 				     int profile, 				     format_list_t *sdp_media,				     video_info_t *video,				     const uint8_t *user_data,				     uint32_t userdata_size,				     video_vft_t *if_vft,				     void *ifptr);/* * c_close_f - close plugin - free all data, including ptr */typedef void (*c_close_f)(codec_data_t *ptr);/* * c_do_pause_f - called when a pause has taken place.  Next data may not * match previous - skip may occur */typedef void (*c_do_pause_f)(codec_data_t *ptr);/* * c_decode_frame_f - ah, the money callback.  decode the frame * Inputs: ptr - pointer to codec handle *         ts - pointer to frame_timestamp_t for this frame *         from_rtp - if it's from RTP - may not be needed *         buffer - pointer to frame to decode (can be guaranteed that there *           is a complete frame - maybe more than 1 *         buflen - length of buffer * Outputs: *         sync_frame - 1 if a special frame (for example, an I frame for *	              video) * Returns: *        -1 - couldn't decode in whole frame *       <1-buflen> - number of bytes decoded */typedef int (*c_decode_frame_f)(codec_data_t *ptr,				frame_timestamp_t *ts,				int from_rtp,				int *sync_frame,				uint8_t *buffer,				uint32_t buflen, 				void *userdata);typedef int (*c_video_frame_is_sync_f)(codec_data_t *ptr,				       uint8_t *buffer,				       uint32_t buflen,				       void *userdata);typedef int (*c_print_status_f)(codec_data_t *ptr, 				char *buffer, 				uint32_t buflen);/* * c_compress_check_f - see if a plugin can decode the bit stream *  note - create function from above must be called afterwards * Inputs - msg - can use for debug messages *   stream_type - see above. *   compressor - pointer to codec.   *   type - video type.  valid for .mp4 files *   profile - video profile level - valid for .mp4 files *   fptr - pointer to sdp data *   userdata - pointer to user data to check out - might have VOL header, *     for example *   userdata_size - size of userdata in bytes * Return Value - -1 for not handled. *                number - weighted value of how well decoding can do. */typedef int (*c_compress_check_f)(lib_message_func_t msg,				  const char *stream_type,				  const char *compressor,				  int type,				  int profile,				  format_list_t *fptr,				  const uint8_t *userdata,				  uint32_t userdata_size,				  CConfigSet *pConfig);/* * c_raw_file_check_f - see if this codec can handle raw files * Note - this could be designed a bit better - like a 2 stage check *   and create. * Inputs: msg - for debug messags *         filename - name of file (duh) * Outputs - max_time 0.0 if not seekable, otherwise time *           desc[4] - 4 slots for descriptions */typedef codec_data_t *(*c_raw_file_check_f)(lib_message_func_t msg,					    const char *filename,					    double *max_time,					    char *desc[4],					    CConfigSet *pConfig);/* * c_raw_file_next_frame_f - get a data buffer with a full frame of data * Inputs: your_data - handle * Outputs: buffer - pointer to buffer *          ts - pointer to frame_timestamp_t structure to fill in. * Return value - number of bytes (0 for no frame) */typedef int (*c_raw_file_next_frame_f)(codec_data_t *your_data,				       uint8_t **buffer,				       frame_timestamp_t *ts);/* * c_raw_file_used_for_frame_f - indicates number of bytes decoded * by decoder */typedef void (*c_raw_file_used_for_frame_f)(codec_data_t *your_data,					    uint32_t bytes);/* * c_raw_file_seek_to_f - seek to ts in msec */typedef int (*c_raw_file_seek_to_f)(codec_data_t *your_data,				    uint64_t ts);/* * c_raw_file_skip_frame_f - indicates that we should skip the next frame * used for video raw frames only */typedef int (*c_raw_file_skip_frame_f)(codec_data_t *ptr);/* * c_raw_file_has_eof_f - return indication of end of file reached */typedef int (*c_raw_file_has_eof_f)(codec_data_t *ptr);typedef struct codec_plugin_t {  const char *c_name;  const char *c_type;  const char *c_version;  ac_create_f  ac_create;  vc_create_f  vc_create;  // add vc_create_f here and below  c_do_pause_f            c_do_pause;  c_decode_frame_f        c_decode_frame;  c_close_f               c_close;  c_compress_check_f      c_compress_check;  c_raw_file_check_f      c_raw_file_check;  c_raw_file_next_frame_f c_raw_file_next_frame;  c_raw_file_used_for_frame_f c_raw_file_used_for_frame;  c_raw_file_seek_to_f    c_raw_file_seek_to;  c_raw_file_skip_frame_f c_skip_frame;  c_raw_file_has_eof_f    c_raw_file_has_eof;  c_video_frame_is_sync_f c_video_frame_is_sync;  c_print_status_f        c_print_status;  SConfigVariable         *c_variable_list;  uint32_t                c_variable_list_count;  tc_create_f   tc_create;} codec_plugin_t;#ifdef _WIN32#define DLL_EXPORT __declspec(dllexport)#else#define DLL_EXPORT#endif/* * Use this for an audio plugin without raw file support */#define AUDIO_CODEC_PLUGIN(name, \                           create, \			   do_pause, \                           decode, \                           print_status, \			   close,\			   compress_check, \			   config_variables, \			   config_variables_count) \extern "C" { codec_plugin_t DLL_EXPORT mpeg4ip_codec_plugin = { \   name, \   "audio", \   PLUGIN_VERSION, \   create, \   NULL, \   do_pause, \   decode, \   close,\   compress_check, \   NULL, NULL, NULL, NULL, NULL, NULL, NULL, print_status, \   config_variables, config_variables_count, NULL,}; }/* * Use this for audio plugin that has raw file support */#define AUDIO_CODEC_WITH_RAW_FILE_PLUGIN(name, \                                         create, \			                 do_pause, \                                         decode, \                                         print_status, \			                 close,\			                 compress_check, \			                 raw_file_check, \			                 raw_file_next_frame, \                                         raw_file_used_for_frame, \			                 raw_file_seek_to, \			                 raw_file_has_eof, \					 config_variables, \                                         config_variables_count)\extern "C" { codec_plugin_t DLL_EXPORT mpeg4ip_codec_plugin = { \   name, \   "audio", \   PLUGIN_VERSION, \   create, \   NULL, \   do_pause, \   decode, \   close,\   compress_check, \   raw_file_check, \   raw_file_next_frame, \   raw_file_used_for_frame, \   raw_file_seek_to, \   NULL, \   raw_file_has_eof, NULL, print_status, \   config_variables, config_variables_count, NULL, }; }/* * Use this for text plugins */#define TEXT_CODEC_PLUGIN(name, \                           create, \			   do_pause, \                           decode, \                           print_status, \			   close,\			   compress_check, \			   config_variables, \			   config_variables_count) \extern "C" { codec_plugin_t DLL_EXPORT mpeg4ip_codec_plugin = { \   name, \   "text", \   PLUGIN_VERSION, \   NULL, \   NULL, \   do_pause, \   decode, \   close,\   compress_check, \   NULL, NULL, NULL, NULL, NULL, NULL, NULL, print_status, \   config_variables, config_variables_count, create,}; }/* * Use this for a video codec without raw file support */#define VIDEO_CODEC_PLUGIN(name, \                           create, \			   do_pause, \                           decode, \                           print_status, \			   close,\			   compress_check,\			   video_frame_is_sync, \                           config_variables, \                           config_variables_count ) \extern "C" { codec_plugin_t DLL_EXPORT mpeg4ip_codec_plugin = { \   name, \   "video", \   PLUGIN_VERSION, \   NULL, \   create, \   do_pause, \   decode, \   close,\   compress_check, \   NULL, NULL, NULL, NULL, NULL, NULL, video_frame_is_sync, print_status, \   config_variables, config_variables_count, NULL,}; }/* * Use this for video codec with raw file support */#define VIDEO_CODEC_WITH_RAW_FILE_PLUGIN(name, \                                         create, \			                 do_pause, \                                         decode, \                                         print_status, \			                 close,\			                 compress_check, \                                         video_frame_is_sync, \			                 raw_file_check, \			                 raw_file_next_frame, \                                         raw_file_used_for_frame, \			                 raw_file_seek_to, \			                 raw_file_skip_frame, \                                         raw_file_has_eof, \                                         config_variables, \					 config_variables_count) \extern "C" { codec_plugin_t DLL_EXPORT mpeg4ip_codec_plugin = { \   name, \   "video", \   PLUGIN_VERSION, \   NULL, \   create, \   do_pause, \   decode, \   close,\   compress_check, \   raw_file_check, \   raw_file_next_frame, \   raw_file_used_for_frame, \   raw_file_seek_to, \   raw_file_skip_frame,\   raw_file_has_eof, \   video_frame_is_sync, \   print_status, \   config_variables, \   config_variables_count, NULL,\}; }          #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -