100 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
100 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
101 &numStreams); |
101 &numStreams); |
102 if (ret != XA_RESULT_SUCCESS) |
102 if (ret != XA_RESULT_SUCCESS) |
103 { |
103 { |
104 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
104 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
105 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamType"); |
105 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamType"); |
106 return ret; |
106 return ret; |
107 } |
107 } |
108 |
108 |
109 /* validate stream index */ |
109 /* validate stream index */ |
110 if (streamIndex > numStreams) |
110 if (streamIndex > numStreams) |
111 { |
111 { |
112 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
112 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
113 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamType"); |
113 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamType"); |
114 return XA_RESULT_PARAMETER_INVALID; |
114 return XA_RESULT_PARAMETER_INVALID; |
115 } |
115 } |
116 |
116 |
117 /* if format type is raw image */ |
117 /* if format type is raw image */ |
118 xaDataSource = ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->xaSource; |
118 xaDataSource = ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->xaSource; |
192 ret = mmf_get_codec_id(mmfctx, &codecId); |
192 ret = mmf_get_codec_id(mmfctx, &codecId); |
193 ret = mmf_streaminformationitf_get_videoframesize(mmfctx, |
193 ret = mmf_streaminformationitf_get_videoframesize(mmfctx, |
194 &height, &width, &frameRate); |
194 &height, &width, &frameRate); |
195 break; |
195 break; |
196 case XA_DOMAINTYPE_IMAGE: |
196 case XA_DOMAINTYPE_IMAGE: |
197 DEBUG_INFO("Getting Image Stream Info from SrcPad"); |
197 case XA_DOMAINTYPE_MIDI: |
198 break; |
|
199 default: |
198 default: |
200 DEBUG_ERR("XA_RESULT_CONTENT_UNSUPPORTED"); |
199 DEBUG_ERR("XA_RESULT_CONTENT_UNSUPPORTED"); |
201 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamInformation"); |
|
202 ret = XA_RESULT_CONTENT_UNSUPPORTED; |
200 ret = XA_RESULT_CONTENT_UNSUPPORTED; |
203 break; |
201 break; |
204 }; |
202 }; |
205 |
203 |
206 if (ret == XA_RESULT_SUCCESS) |
204 if (ret != XA_RESULT_SUCCESS) |
207 { |
205 { |
208 DEBUG_INFO("Getting media duration"); |
206 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
209 ret = XAPlayItfAdaptMMF_GetDuration(adaptCtx, &duration); |
207 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamInformation"); |
|
208 return ret; |
|
209 } |
|
210 |
|
211 DEBUG_INFO("Getting media duration"); |
|
212 ret = XAPlayItfAdaptMMF_GetDuration(adaptCtx, &duration); |
|
213 |
|
214 if (ret != XA_RESULT_SUCCESS) |
|
215 { |
|
216 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
|
217 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamInformation"); |
|
218 return ret; |
210 } |
219 } |
211 |
220 |
212 /* Now assign properties to data structure */ |
221 /* Now assign properties to data structure */ |
213 if (ret == XA_RESULT_SUCCESS) |
222 switch (domain) |
214 { |
223 { |
215 switch (domain) |
224 case XA_DOMAINTYPE_AUDIO: |
216 { |
225 { |
217 case XA_DOMAINTYPE_AUDIO: |
226 XAAudioStreamInformation* streamInfo = |
218 { |
227 (XAAudioStreamInformation*) info; |
219 XAAudioStreamInformation* streamInfo = |
228 DEBUG_INFO("Assigning values for XAAudioStreamInformation"); |
220 (XAAudioStreamInformation*) info; |
229 streamInfo->codecId = codecId; |
221 DEBUG_INFO("Assigning values for XAAudioStreamInformation"); |
230 streamInfo->channels = channels; |
222 streamInfo->codecId = codecId; |
231 streamInfo->sampleRate = sampleRate; |
223 streamInfo->channels = channels; |
232 streamInfo->bitRate = bitRate; |
224 streamInfo->sampleRate = sampleRate; |
233 streamInfo->langCountry[0] = '\0'; |
225 streamInfo->bitRate = bitRate; |
234 streamInfo->duration = duration; |
226 streamInfo->langCountry[0] = '\0'; |
235 } |
227 streamInfo->duration = duration; |
236 break; |
228 } |
237 /* |
229 break; |
238 case XA_DOMAINTYPE_MIDI: |
230 case XA_DOMAINTYPE_MIDI: |
239 { |
231 { |
240 XAMIDIStreamInformation* streamInfo = |
232 XAMIDIStreamInformation* streamInfo = |
241 (XAMIDIStreamInformation*) info; |
233 (XAMIDIStreamInformation*) info; |
242 DEBUG_INFO("Assigning values for XAMIDIStreamInformation");*/ |
234 DEBUG_INFO("Assigning values for XAMIDIStreamInformation"); |
243 /*currently there is no way to get these information from gstreamer*/ |
235 /*currently there is no way to get these information from gstreamer*/ |
244 /* streamInfo->channels = XA_MIDI_UNKNOWN; |
236 streamInfo->channels = XA_MIDI_UNKNOWN; |
245 streamInfo->tracks = XA_MIDI_UNKNOWN; |
237 streamInfo->tracks = XA_MIDI_UNKNOWN; |
246 streamInfo->bankType = XA_MIDIBANK_DEVICE;*/ |
238 streamInfo->bankType = XA_MIDIBANK_DEVICE; |
247 /*streamInfo->bitRate = 0;*/ |
239 /*streamInfo->bitRate = 0;*/ |
248 /* streamInfo->langCountry[0] = '\0'; |
240 streamInfo->langCountry[0] = '\0'; |
249 streamInfo->duration = duration; |
241 streamInfo->duration = duration; |
250 } |
242 } |
251 break; |
243 break; |
252 */ |
244 case XA_DOMAINTYPE_VIDEO: |
253 case XA_DOMAINTYPE_VIDEO: |
245 { |
254 { |
246 XAVideoStreamInformation* streamInfo = |
255 XAVideoStreamInformation* streamInfo = |
247 (XAVideoStreamInformation*) info; |
256 (XAVideoStreamInformation*) info; |
248 DEBUG_INFO("Assigning values for XAVideoStreamInformation"); |
257 DEBUG_INFO("Assigning values for XAVideoStreamInformation"); |
249 streamInfo->codecId = codecId; |
258 streamInfo->codecId = codecId; |
250 streamInfo->width = width; |
259 streamInfo->width = width; |
251 streamInfo->height = height; |
260 streamInfo->height = height; |
252 streamInfo->bitRate = bitRate; |
261 streamInfo->bitRate = bitRate; |
253 streamInfo->duration = duration; |
262 streamInfo->duration = duration; |
254 streamInfo->frameRate = frameRate; |
263 streamInfo->frameRate = frameRate; |
255 } |
264 } |
256 break; |
265 break; |
257 case XA_DOMAINTYPE_IMAGE: |
266 /* |
258 { |
267 case XA_DOMAINTYPE_IMAGE: |
259 XAImageStreamInformation* streamInfo = |
268 { |
260 (XAImageStreamInformation*) info; |
269 XAImageStreamInformation* streamInfo = |
261 DEBUG_INFO("Assigning values for XAImageStreamInformation"); |
270 (XAImageStreamInformation*) info; |
262 streamInfo->codecId = codecId; |
271 DEBUG_INFO("Assigning values for XAImageStreamInformation"); |
263 streamInfo->width = width; |
272 streamInfo->codecId = codecId; |
264 streamInfo->height = height; |
273 streamInfo->width = width; |
265 streamInfo->presentationDuration = duration; |
274 streamInfo->height = height; |
266 } |
275 streamInfo->presentationDuration = duration; |
267 break; |
276 } |
268 default: |
277 break; |
269 break; |
278 default: |
270 }; |
279 break; |
271 } /*if ( ret == XA_RESULT_SUCCESS)*/ |
280 */ |
272 |
281 }; |
273 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamInformation"); |
282 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamInformation"); |
274 return ret; |
283 return ret; |
275 } |
284 } |
276 |
285 |
277 /* |
286 /* |
278 * XAresult XAStreamInformationItfAdaptMMF_QueryStreamName( |
287 * XAresult XAStreamInformationItfAdaptMMF_QueryStreamName( |
293 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
302 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
294 if (!adaptCtx || !pNameSize || (adaptCtx->ctxId |
303 if (!adaptCtx || !pNameSize || (adaptCtx->ctxId |
295 != XAMediaPlayerAdaptation)) |
304 != XAMediaPlayerAdaptation)) |
296 { |
305 { |
297 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
306 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
298 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamName"); |
307 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamName"); |
299 return XA_RESULT_PARAMETER_INVALID; |
308 return XA_RESULT_PARAMETER_INVALID; |
300 } |
309 } |
301 |
310 |
302 /* validate stream index */ |
311 /* validate stream index */ |
303 ret = mmf_streaminformationitf_get_numstreams( |
312 ret = mmf_streaminformationitf_get_numstreams( |
304 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
313 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
305 &numStreams); |
314 &numStreams); |
306 if (ret != XA_RESULT_SUCCESS) |
315 if (ret != XA_RESULT_SUCCESS) |
307 { |
316 { |
308 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
317 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
309 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamName"); |
318 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamName"); |
310 return ret; |
319 return ret; |
311 } |
320 } |
312 |
321 |
313 /* validate stream index */ |
322 /* validate stream index */ |
314 if (streamIndex > numStreams) |
323 if (streamIndex > numStreams) |
315 { |
324 { |
316 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
325 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
317 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryStreamName"); |
326 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryStreamName"); |
318 return XA_RESULT_PARAMETER_INVALID; |
327 return XA_RESULT_PARAMETER_INVALID; |
319 } |
328 } |
320 |
329 |
321 /* TODO there is no straight way to retreive stream name from mmf*/ |
330 /* TODO there is no straight way to retreive stream name from mmf*/ |
322 /*XAuint16 inputNameSize = *pNameSize;*/ |
331 /*XAuint16 inputNameSize = *pNameSize;*/ |
349 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
358 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
350 if (!adaptCtx || !numStreams || (adaptCtx->ctxId |
359 if (!adaptCtx || !numStreams || (adaptCtx->ctxId |
351 != XAMediaPlayerAdaptation)) |
360 != XAMediaPlayerAdaptation)) |
352 { |
361 { |
353 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
362 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
354 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
363 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
355 return XA_RESULT_PARAMETER_INVALID; |
364 return XA_RESULT_PARAMETER_INVALID; |
356 } |
365 } |
357 |
366 |
358 if (adaptCtx->ctxId == XAMDAdaptation) |
367 if (adaptCtx->ctxId == XAMDAdaptation) |
359 { |
368 { |
360 DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); |
369 DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); |
361 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
370 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
362 return XA_RESULT_PRECONDITIONS_VIOLATED; |
371 return XA_RESULT_PRECONDITIONS_VIOLATED; |
363 } |
372 } |
364 |
373 |
365 /* Determine number of streams */ |
374 /* Determine number of streams */ |
366 ret = mmf_streaminformationitf_get_numstreams( |
375 ret = mmf_streaminformationitf_get_numstreams( |
367 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
376 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
368 &inputNumStreams); |
377 &inputNumStreams); |
369 if (ret != XA_RESULT_SUCCESS) |
378 if (ret != XA_RESULT_SUCCESS) |
370 { |
379 { |
371 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
380 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
372 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
381 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
373 return ret; |
382 return ret; |
374 } |
383 } |
375 |
384 |
376 if (activeStreams) |
385 if (activeStreams) |
377 { |
386 { |
378 XAuint32 loopIndex; |
387 XAuint32 loopIndex; |
379 if (*numStreams < inputNumStreams) |
388 if (*numStreams < inputNumStreams) |
380 { |
389 { |
381 DEBUG_INFO("numStreams param value is smaller than number of streams"); |
390 DEBUG_INFO("numStreams param value is smaller than number of streams"); |
382 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
391 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
383 return XA_RESULT_PARAMETER_INVALID; |
392 return XA_RESULT_PARAMETER_INVALID; |
384 } |
393 } |
385 for (loopIndex = 0; loopIndex < inputNumStreams; loopIndex++) |
394 for (loopIndex = 0; loopIndex < inputNumStreams; loopIndex++) |
386 { |
395 { |
387 /* TODO currently gstreamer doesn't allow multiple dynamic streams |
396 /* TODO currently gstreamer doesn't allow multiple dynamic streams |
409 |
418 |
410 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
419 /* Both Media Player and Metadata Extractor objec uses the same ctxId */ |
411 if (!adaptCtx || (adaptCtx->ctxId != XAMediaPlayerAdaptation)) |
420 if (!adaptCtx || (adaptCtx->ctxId != XAMediaPlayerAdaptation)) |
412 { |
421 { |
413 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
422 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
414 DEBUG_API("-<XAStreamInformationItfAdaptMMF_SetActiveStream"); |
423 DEBUG_API("<-XAStreamInformationItfAdaptMMF_SetActiveStream"); |
415 return XA_RESULT_PARAMETER_INVALID; |
424 return XA_RESULT_PARAMETER_INVALID; |
416 } |
425 } |
417 |
426 |
418 if (adaptCtx->ctxId == XAMDAdaptation) |
427 if (adaptCtx->ctxId == XAMDAdaptation) |
419 { |
428 { |
420 DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); |
429 DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); |
421 DEBUG_API("-<XAStreamInformationItfAdaptMMF_SetActiveStream"); |
430 DEBUG_API("<-XAStreamInformationItfAdaptMMF_SetActiveStream"); |
422 return XA_RESULT_PRECONDITIONS_VIOLATED; |
431 return XA_RESULT_PRECONDITIONS_VIOLATED; |
423 } |
432 } |
424 |
433 |
425 /* Determine number of streams */ |
434 /* Determine number of streams */ |
426 ret = mmf_streaminformationitf_get_numstreams( |
435 ret = mmf_streaminformationitf_get_numstreams( |
427 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
436 ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, |
428 &numStreams); |
437 &numStreams); |
429 if (ret != XA_RESULT_SUCCESS) |
438 if (ret != XA_RESULT_SUCCESS) |
430 { |
439 { |
431 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
440 DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); |
432 DEBUG_API("-<XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
441 DEBUG_API("<-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); |
433 return ret; |
442 return ret; |
434 } |
443 } |
435 |
444 |
436 /* validate stream index */ |
445 /* validate stream index */ |
437 if (streamNum > numStreams) |
446 if (streamNum > numStreams) |
438 { |
447 { |
439 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
448 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
440 DEBUG_API("-<XAStreamInformationItfAdaptMMF_SetActiveStream"); |
449 DEBUG_API("<-XAStreamInformationItfAdaptMMF_SetActiveStream"); |
441 return XA_RESULT_PARAMETER_INVALID; |
450 return XA_RESULT_PARAMETER_INVALID; |
442 } |
451 } |
443 |
452 |
444 if (commitNow) |
453 if (commitNow) |
445 { |
454 { |