Fplay: update

git-svn-id: svn://kolibrios.org@6438 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-05-28 10:47:44 +00:00
parent f105b9cfdf
commit e4cdc1239f
2 changed files with 24 additions and 5 deletions

View File

@ -133,6 +133,8 @@ struct vstate
AVCodecContext *aCtx; /* audio decoder context */ AVCodecContext *aCtx; /* audio decoder context */
AVCodec *vCodec; /* video codec */ AVCodec *vCodec; /* video codec */
AVCodec *aCodec; /* audio codec */ AVCodec *aCodec; /* audio codec */
enum AVCodecID codec_id;
int codec_profile;
char *input_file; char *input_file;
char *input_name; char *input_name;
int vStream; /* video stream index */ int vStream; /* video stream index */

View File

@ -398,14 +398,32 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
VAProfile profile = avctx->profile; VAProfile profile = avctx->profile;
enum AVCodecID codec = avctx->codec_id; enum AVCodecID codec = avctx->codec_id;
printf("%s codec %d profile %x\n", __FUNCTION__,avctx->codec_id, avctx->profile);
if (codec == AV_CODEC_ID_H264) if (codec == AV_CODEC_ID_H264)
{ {
if(profile == FF_PROFILE_H264_BASELINE) if(profile == FF_PROFILE_H264_BASELINE)
profile = FF_PROFILE_H264_CONSTRAINED_BASELINE; profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;
}; };
if(avctx->hwaccel_context != NULL &&
(vst->codec_id != codec ||
vst->codec_profile != profile))
{
struct decoder* decoder = vst->decoder;
printf("\n%s codec changed!!!\n"
"old id %d profile %x new id %d profile %x\n",
__FUNCTION__, vst->codec_id, vst->codec_profile,
codec, profile);
for(int i = 0; i < decoder->nframes; i++)
{
vframe_t *vframe = &decoder->vframes[i];
vframe->format = AV_PIX_FMT_NONE;
};
}
printf("\n%s codec %d profile %x\n", __FUNCTION__,avctx->codec_id, avctx->profile);
for (int i = 0; fmt[i] != PIX_FMT_NONE; i++) for (int i = 0; fmt[i] != PIX_FMT_NONE; i++)
{ {
if (fmt[i] != AV_PIX_FMT_VAAPI_VLD) if (fmt[i] != AV_PIX_FMT_VAAPI_VLD)
@ -420,6 +438,8 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
if (vaapi_init_decoder(vst, profile, VAEntrypointVLD, avctx->width, avctx->height) == 0) if (vaapi_init_decoder(vst, profile, VAEntrypointVLD, avctx->width, avctx->height) == 0)
{ {
avctx->hwaccel_context = v_context; avctx->hwaccel_context = v_context;
vst->codec_id = codec;
vst->codec_profile = profile;
printf("%s format: %x\n",__FUNCTION__, fmt[i]); printf("%s format: %x\n",__FUNCTION__, fmt[i]);
return fmt[i]; return fmt[i];
} }
@ -458,9 +478,6 @@ static int get_buffer2(AVCodecContext *avctx, AVFrame *pic, int flags)
return 0; return 0;
} }
struct vaapi_context va_context_storage;
#define EGL_TEXTURE_Y_U_V_WL 0x31D7 #define EGL_TEXTURE_Y_U_V_WL 0x31D7
#define EGL_TEXTURE_Y_UV_WL 0x31D8 #define EGL_TEXTURE_Y_UV_WL 0x31D8