On Sat, Nov 15, 2008 at 8:32 PM, jayasena s <jaisena@ya...> wrote:
> Hi,
>
> I am able to play m4v and .h264 files with gst-openmax and bellagio openmax
> IL, but having problem playing h264 mp4 file. I found that gst-openmax
> passes demuxed raw video and audio frame streams to the bellagio openmax IL,
> but not the header data required for decoding. Also I found that config data
> is passed to the gst-openmax from qtdemux, but gst-openmax somehow is not
> passing the header data to the bellagio openmax IL. I would like to know
> why header data is not passed to the bellagio openmax IL. Whether
> gst-openmax is going to fix this problem in future release.
 
Hi Jayasena,
 
We are using gst-openmax 0.10.0.4 and libomxil-bellagio 0.3.4. We have also faced this issue with .mp4 files and modified the "sink_setcaps" function in gstomx_base_videodec.c file to update extradata in omx library.
 
Check the following function it may help you. If you want to integrate this code then you should accordingly update the enum and structure in gstomx header file.
 
static gboolean
sink_setcaps (GstPad *pad,
              GstCaps *caps)
{
    GstStructure *structure;
    GstOmxBaseVideoDec *self;
    GstOmxBaseFilter *omx_base;
    GOmxCore *gomx;
    OMX_PARAM_PORTDEFINITIONTYPE *param;
    gint width = 0;
    gint height = 0;
    self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad));
    omx_base = GST_OMX_BASE_FILTER (self);
    gomx = (GOmxCore *) omx_base->gomx;
    GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
    g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE);
    structure = gst_caps_get_structure (caps, 0);
    gst_structure_get_int (structure, "width", &width);
    gst_structure_get_int (structure, "height", &height);
    param = calloc (1, sizeof (OMX_PARAM_PORTDEFINITIONTYPE));
    param->nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
    param->nVersion.s.nVersionMajor = 1;
    param->nVersion.s.nVersionMinor = 1;
    {
        const GValue *codec_data;
        GstBuffer *buffer;
        codec_data = gst_structure_get_value (structure, "codec_data");
        if (codec_data) {
            gint size,err;
            OMX_INDEXTYPE eIndexExtraData;
            buffer = gst_value_get_buffer (codec_data);
            buffer = GST_BUFFER_CAST (gst_value_get_mini_object (codec_data));
            size = GST_BUFFER_SIZE (buffer);
            printf("In %s extradata_size=%d (line=%d)\n",__func__,size,__LINE__);
            err = OMX_GetExtensionIndex(gomx->omx_handle,"OMX.ST.index.config.videoextradata",&eIndexExtraData);
            if(err != OMX_ErrorNone) {
              printf("Error in get video extension index\n");
            } else {
              OMX_VENDOR_EXTRADATATYPE sExtraData;
              sExtraData.nPortIndex = 0;
              sExtraData.pData      = malloc(size);
              sExtraData.nDataSize  = size;
              memcpy(sExtraData.pData,GST_BUFFER_DATA (buffer),size);
              printf("Setting ExtraData\n");
              err = OMX_SetConfig(gomx->omx_handle, eIndexExtraData, &sExtraData);
              if(err != OMX_ErrorNone) {
                printf("\n Video decoder Set Config Failed error=%08x\n",err);
              }
              free(sExtraData.pData);
            }
            fflush(stdout);
            omx_base->codec_data = buffer;
            gst_buffer_ref (buffer);
        }
    }
    /* Input port configuration. */
    {
        param->nPortIndex = 0;
        OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, param);
        param->format.video.nFrameWidth = width;
        param->format.video.nFrameHeight = height;
        OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, param);
    }
    free (param);
    return gst_pad_set_caps (pad, caps);
}