]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7500: update yuv codec
authorSeven Du <dujinfang@gmail.com>
Mon, 4 Aug 2014 07:23:12 +0000 (15:23 +0800)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:46:42 +0000 (12:46 -0500)
src/mod/codecs/mod_yuv/mod_yuv.c

index db8d9718e6a70269d86a2a2ad7d35e277159c026..6748e61f1294ffb380f2b65057029d6b912236a2 100644 (file)
@@ -51,10 +51,8 @@ static switch_status_t switch_yuv_init(switch_codec_t *codec, switch_codec_flag_
 }
 
 static switch_status_t switch_yuv_encode(switch_codec_t *codec,
-                                                                                 switch_codec_t *other_codec,
-                                                                                 void *decoded_data,
-                                                                                 uint32_t decoded_data_len,
-                                                                                 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+                                                                                 switch_image_t *img,
+                                                                                 void *encoded_data, uint32_t *encoded_data_len,
                                                                                  unsigned int *flag)
 {
        /* yuv encode is unclear, so return 0 for now */
@@ -64,18 +62,13 @@ static switch_status_t switch_yuv_encode(switch_codec_t *codec,
 }
 
 static switch_status_t switch_yuv_decode(switch_codec_t *codec,
-                                                                                 switch_codec_t *other_codec,
-                                                                                 void *encoded_data,
-                                                                                 uint32_t encoded_data_len,
-                                                                                 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+                                                                                 switch_frame_t *frame,
+                                                                                 switch_image_t **img,
                                                                                  unsigned int *flag)
 {
-       if (*decoded_data_len < encoded_data_len) return SWITCH_STATUS_FALSE;
+       switch_assert(frame);
 
-       codec->dec_picture.width = codec->enc_picture.width;
-       codec->dec_picture.height = codec->enc_picture.height;
-       memcpy(decoded_data, encoded_data, encoded_data_len);
-       *decoded_data_len = encoded_data_len;
+       *img = (switch_image_t *)frame->user_data;
        return SWITCH_STATUS_SUCCESS;
 }