From 85906bee3da93fa30a4d3c9e4b67b6a6bc2891df Mon Sep 17 00:00:00 2001 From: "satheesan.en" Date: Thu, 10 Sep 2015 13:37:31 +0530 Subject: [PATCH] codec_data is passed through media_packet_set_extra() API Change-Id: I9c5f2f8e81ef236b965a58b3cdfb84e0a4bea694 Signed-off-by: Satheesan E N Signed-off-by: Mahesh Kondiparthi --- src/port_gst/mediamuxer_port_gst.c | 18 ++++++++++-------- test/mediamuxer_test.c | 9 +++++---- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/port_gst/mediamuxer_port_gst.c b/src/port_gst/mediamuxer_port_gst.c index 7ef56ff..6895b9d 100644 --- a/src/port_gst/mediamuxer_port_gst.c +++ b/src/port_gst/mediamuxer_port_gst.c @@ -724,12 +724,13 @@ int _gst_set_caps(MMHandleType pHandle, media_packet_h packet) switch (formattype) { case MEDIA_FORMAT_AUDIO: - if (media_packet_get_codec_data(packet, - (void **)&codec_data, &codec_data_size)) { - MX_E("media_packet_get_codec_data call failed\n"); + if (media_packet_get_extra(packet, + (void **)&codec_data)) { + MX_E("media_packet_get_extra call failed\n"); ret = MX_ERROR_UNKNOWN; break; } + codec_data_size = strlen(codec_data) + 1; MX_I("extracted codec data is =%s size is %d\n", codec_data, codec_data_size); if (gst_handle->audio_track.caps == NULL || @@ -793,12 +794,13 @@ int _gst_set_caps(MMHandleType pHandle, media_packet_h packet) } break; case MEDIA_FORMAT_VIDEO: - if (media_packet_get_codec_data(packet, - (void **)&codec_data, &codec_data_size)) { - MX_E("media_packet_get_codec_data call failed\n"); + if (media_packet_get_extra(packet, + (void **)&codec_data)) { + MX_E("media_packet_get_extra call failed\n"); ret = MX_ERROR_UNKNOWN; break; } + codec_data_size = strlen(codec_data) + 1; MX_I("codec data is =%s size is %d\n", codec_data, codec_data_size); if (gst_handle->video_track.caps == NULL || @@ -851,8 +853,8 @@ int _gst_set_caps(MMHandleType pHandle, media_packet_h packet) new_cap, NULL); #else /*Debugging purpose. The whole caps filter can be sent via codec_data*/ - media_packet_get_codec_data(packet, &codec_data, - &codec_data_size); + media_packet_get_extra(packet, &codec_data);, + codec_data_size = strlen(codec_data) + 1; MX_I("extracted codec data is =%s\n", codec_data); new_cap = gst_caps_from_string(codec_data); MX_I("New cap is=%s\n", codec_data); diff --git a/test/mediamuxer_test.c b/test/mediamuxer_test.c index 78a7ece..eb820be 100644 --- a/test/mediamuxer_test.c +++ b/test/mediamuxer_test.c @@ -260,7 +260,7 @@ static void _mediacodec_fill_buffer_cb(media_packet_h pkt, void *user_data) enc_vide_pkt_available = 1; uint64_t pts, dts, duration, size; media_buffer_flags_e flags; - void *codec_data; + char *codec_data; void *pkt_data; unsigned int codec_data_size; @@ -276,7 +276,8 @@ static void _mediacodec_fill_buffer_cb(media_packet_h pkt, void *user_data) media_packet_get_duration(pkt, &duration); /* offset */ media_packet_get_flags(pkt, &flags); - media_packet_get_codec_data(pkt,&codec_data,&codec_data_size); + media_packet_get_extra(pkt,(void**)&codec_data); + codec_data_size = strlen(codec_data) + 1; g_print("***pkt attributes before writing *** Size=%"PRIu64", pts=%"PRIu64", dts=%"PRIu64", duration=%"PRIu64", flags=%d\n",size,pts,dts,duration,(int)flags); g_print("Codec_data=%s\ncodec_data_size = %d\n",(char*)codec_data,codec_data_size); @@ -731,7 +732,7 @@ static void __audio_app_sink_callback(GstElement *sink, CustomData *data) return; } - if (media_packet_set_codec_data(aud_pkt, aud_caps, strlen(aud_caps)+1)) { + if (media_packet_set_extra(aud_pkt, aud_caps)) { g_print("unable to set the audio codec data e\n"); return; } @@ -839,7 +840,7 @@ static void __video_app_sink_callback(GstElement *sink, CustomData *data) g_print("unable to set the flag size\n"); return; } - if (media_packet_set_codec_data(vid_pkt, vid_caps, strlen(vid_caps)+1)) { + if (media_packet_set_extra(vid_pkt, vid_caps)) { g_print("unable to set the video codec data e\n"); return; } -- 2.7.4