}
static int try_decode_frame(AVStream *st, const uint8_t *data, int size){    int16_t *samples;    AVCodec *codec;    int got_picture, ret;    AVFrame picture;        codec = avcodec_find_decoder(st->codec.codec_id);    if (!codec)        return -1;    ret = avcodec_open(&st->codec, codec);    if (ret < 0)        return ret;    switch(st->codec.codec_type) {    case CODEC_TYPE_VIDEO:        ret = avcodec_decode_video(&st->codec, &picture,                                    &got_picture, (uint8_t *)data, size);        break;    case CODEC_TYPE_AUDIO:        samples = av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);        if (!samples)            goto fail;        ret = avcodec_decode_audio(&st->codec, samples,                                    &got_picture, (uint8_t *)data, size);        av_free(samples);        break;    default:        break;    } fail:    avcodec_close(&st->codec);    return ret;}