本文整理汇总了C++中AVCodecParser类的典型用法代码示例。如果您正苦于以下问题:C++ AVCodecParser类的具体用法?C++ AVCodecParser怎么用?C++ AVCodecParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AVCodecParser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogStr
AVCodecParserContext *av_parser_init( int codec_id )
{
LogStr("Init");
AVCodecParserContext *s;
AVCodecParser *parser;
int ret;
if (codec_id == CODEC_ID_NONE)
{
LogStr("Exit");
return NULL;
}
for (parser = av_first_parser; parser != NULL; parser = parser->next)
{
if (parser->codec_ids[0] == codec_id || parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || parser->codec_ids[3] == codec_id || parser->codec_ids[4] == codec_id)
{
goto found;
}
}
LogStr("Exit");
return NULL;
found: s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
{
LogStr("Exit");
return NULL;
}
s->parser = parser;
s->priv_data = av_mallocz(parser->priv_data_size);
if (!s->priv_data)
{
av_free(s);
LogStr("Exit");
return NULL;
}
if (parser->parser_init)
{
ret = parser->parser_init(s);
if (ret != 0)
{
av_free(s->priv_data);
av_free(s);
LogStr("Exit");
return NULL;
}
}
s->fetch_timestamp = 1;
s->pict_type = FF_I_TYPE;
LogStr("Exit");
return s;
}
示例2: av_mallocz
AVCodecParserContext *av_parser_init(int codec_id)
{
AVCodecParserContext *s = NULL;
AVCodecParser *parser;
int ret;
if (codec_id == AV_CODEC_ID_NONE)
return NULL;
for (parser = av_first_parser; parser; parser = parser->next) {
if (parser->codec_ids[0] == codec_id ||
parser->codec_ids[1] == codec_id ||
parser->codec_ids[2] == codec_id ||
parser->codec_ids[3] == codec_id ||
parser->codec_ids[4] == codec_id)
goto found;
}
return NULL;
found:
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
goto err_out;
s->parser = parser;
s->priv_data = av_mallocz(parser->priv_data_size);
if (!s->priv_data)
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
if (parser->parser_init) {
ret = parser->parser_init(s);
if (ret != 0)
goto err_out;
}
s->key_frame = -1;
#if FF_API_CONVERGENCE_DURATION
FF_DISABLE_DEPRECATION_WARNINGS
s->convergence_duration = 0;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->dts_sync_point = INT_MIN;
s->dts_ref_dts_delta = INT_MIN;
s->pts_dts_delta = INT_MIN;
s->format = -1;
return s;
err_out:
if (s)
av_freep(&s->priv_data);
av_free(s);
return NULL;
}
示例3: av_mallocz
AVCodecParserContext *av_parser_init(int codec_id)
{
AVCodecParserContext *s;
AVCodecParser *parser;
int ret;
if (codec_id == AV_CODEC_ID_NONE)
return NULL;
for (parser = av_first_parser; parser != NULL; parser = parser->next) {
if (parser->codec_ids[0] == codec_id ||
parser->codec_ids[1] == codec_id ||
parser->codec_ids[2] == codec_id ||
parser->codec_ids[3] == codec_id ||
parser->codec_ids[4] == codec_id)
goto found;
}
return NULL;
found:
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
return NULL;
s->parser = parser;
if (parser->priv_data_size) {
s->priv_data = av_mallocz(parser->priv_data_size);
if (!s->priv_data) {
av_free(s);
return NULL;
}
}
if (parser->parser_init) {
ret = parser->parser_init(s);
if (ret != 0) {
av_free(s->priv_data);
av_free(s);
return NULL;
}
}
s->fetch_timestamp = 1;
s->pict_type = AV_PICTURE_TYPE_I;
s->key_frame = -1;
s->convergence_duration = 0;
s->dts_sync_point = INT_MIN;
s->dts_ref_dts_delta = INT_MIN;
s->pts_dts_delta = INT_MIN;
s->format = -1;
return s;
}