本文整理汇总了C++中picture_NewFromFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ picture_NewFromFormat函数的具体用法?C++ picture_NewFromFormat怎么用?C++ picture_NewFromFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了picture_NewFromFormat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: calloc
subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
{
subpicture_region_t *p_region = calloc( 1, sizeof(*p_region ) );
if( !p_region )
return NULL;
p_region->fmt = *p_fmt;
p_region->fmt.p_palette = NULL;
if( p_fmt->i_chroma == VLC_CODEC_YUVP )
{
p_region->fmt.p_palette = calloc( 1, sizeof(*p_region->fmt.p_palette) );
if( p_fmt->p_palette )
*p_region->fmt.p_palette = *p_fmt->p_palette;
}
p_region->i_alpha = 0xff;
if( p_fmt->i_chroma == VLC_CODEC_TEXT )
return p_region;
p_region->p_picture = picture_NewFromFormat( p_fmt );
if( !p_region->p_picture )
{
free( p_region->fmt.p_palette );
free( p_region );
return NULL;
}
return p_region;
}
开发者ID:CityFire,项目名称:vlc,代码行数:29,代码来源:subpicture.c
示例2: VLC_UNUSED
static picture_t *video_new_buffer( vlc_object_t *p_this,
decoder_owner_sys_t *p_sys,
es_format_t *fmt_out )
{
VLC_UNUSED(p_this);
if( fmt_out->video.i_width != p_sys->video.i_width ||
fmt_out->video.i_height != p_sys->video.i_height ||
fmt_out->video.i_chroma != p_sys->video.i_chroma ||
(int64_t)fmt_out->video.i_sar_num * p_sys->video.i_sar_den !=
(int64_t)fmt_out->video.i_sar_den * p_sys->video.i_sar_num )
{
vlc_ureduce( &fmt_out->video.i_sar_num,
&fmt_out->video.i_sar_den,
fmt_out->video.i_sar_num,
fmt_out->video.i_sar_den, 0 );
if( !fmt_out->video.i_visible_width ||
!fmt_out->video.i_visible_height )
{
fmt_out->video.i_visible_width = fmt_out->video.i_width;
fmt_out->video.i_visible_height = fmt_out->video.i_height;
}
fmt_out->video.i_chroma = fmt_out->i_codec;
p_sys->video = fmt_out->video;
}
/* */
fmt_out->video.i_chroma = fmt_out->i_codec;
return picture_NewFromFormat( &fmt_out->video );
}
开发者ID:OneDream,项目名称:faplayer,代码行数:32,代码来源:mosaic_bridge.c
示例3: vout_display_PlacePicture
/**
* Return a direct buffer
*/
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
{
vout_display_sys_t *sys = vd->sys;
(void)requested_count;
if (sys->pool)
return sys->pool;
vout_display_place_t place;
vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
/* */
const uint32_t values[] = { place.x, place.y, place.width, place.height };
xcb_configure_window (sys->conn, sys->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
values);
picture_t *pic = picture_NewFromFormat (&vd->fmt);
if (!pic)
return NULL;
assert (pic->i_planes == 1);
picture_resource_t res = {
.p = {
[0] = {
.i_lines = pic->p->i_lines,
.i_pitch = pic->p->i_pitch,
},
},
};
picture_Release (pic);
unsigned count;
picture_t *pic_array[MAX_PICTURES];
const size_t size = res.p->i_pitch * res.p->i_lines;
for (count = 0; count < MAX_PICTURES; count++)
{
xcb_shm_seg_t seg = (sys->seg_base != 0) ? (sys->seg_base + count) : 0;
if (XCB_picture_Alloc (vd, &res, size, sys->conn, seg))
break;
pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
sys->conn);
if (unlikely(pic_array[count] == NULL))
break;
}
xcb_flush (sys->conn);
if (count == 0)
return NULL;
sys->pool = picture_pool_New (count, pic_array);
if (unlikely(sys->pool == NULL))
while (count > 0)
picture_Release(pic_array[--count]);
return sys->pool;
}
开发者ID:maniacs-m,项目名称:vlc,代码行数:63,代码来源:x11.c
示例4: Create
/*****************************************************************************
* Create
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )
return VLC_ENOMEM;
p_filter->p_sys->p_tmp = picture_NewFromFormat( &p_filter->fmt_in.video );
if( !p_filter->p_sys->p_tmp )
{
free( p_filter->p_sys );
return VLC_ENOMEM;
}
p_filter->p_sys->b_first = true;
p_filter->pf_video_filter = Filter;
config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
p_filter->p_sys->i_factor =
var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "factor" );
vlc_spin_init( &p_filter->p_sys->lock );
var_AddCallback( p_filter, FILTER_PREFIX "factor",
MotionBlurCallback, p_filter->p_sys );
return VLC_SUCCESS;
}
开发者ID:banketree,项目名称:faplayer,代码行数:34,代码来源:motionblur.c
示例5: sizeof
subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
{
subpicture_region_t *p_region = (subpicture_region_t *)calloc( 1, sizeof(*p_region ) ); // sunqueen modify
if( !p_region )
return NULL;
p_region->fmt = *p_fmt;
p_region->fmt.p_palette = NULL;
if( p_fmt->i_chroma == VLC_CODEC_YUVP )
{
p_region->fmt.p_palette = (video_palette_t *)calloc( 1, sizeof(*p_region->fmt.p_palette) ); // sunqueen modify
if( p_fmt->p_palette )
*p_region->fmt.p_palette = *p_fmt->p_palette;
}
p_region->i_alpha = 0xff;
p_region->p_next = NULL;
p_region->p_private = NULL;
p_region->psz_text = NULL;
p_region->p_style = NULL;
p_region->p_picture = NULL;
if( p_fmt->i_chroma == VLC_CODEC_TEXT )
return p_region;
p_region->p_picture = picture_NewFromFormat( p_fmt );
if( !p_region->p_picture )
{
free( p_region->fmt.p_palette );
free( p_region );
return NULL;
}
return p_region;
}
开发者ID:sunqueen,项目名称:vlc-2.1.4.32.subproject-2013,代码行数:34,代码来源:subpicture.c
示例6: sizeof
picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt, int picture_count)
{
// picture_t *picture[picture_count];
picture_t **picture = (picture_t **)calloc(picture_count, sizeof(picture_t *)); // sunqueen modify
for (int i = 0; i < picture_count; i++) {
picture[i] = picture_NewFromFormat(fmt);
if (!picture[i])
goto error;
}
picture_pool_t *pool = picture_pool_New(picture_count, picture);
if (!pool)
goto error;
free(picture); // sunqueen add
return pool;
error:
for (int i = 0; i < picture_count; i++) {
if (!picture[i])
break;
picture_Release(picture[i]);
}
free(picture); // sunqueen add
return NULL;
}
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:26,代码来源:picture_pool.c
示例7: Create
/*****************************************************************************
* Create
*****************************************************************************/
static int Create( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
const vlc_chroma_description_t *p_chroma =
vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
if( p_chroma == NULL || p_chroma->plane_count == 0 )
return VLC_EGENERIC;
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )
return VLC_ENOMEM;
p_filter->p_sys->p_tmp = picture_NewFromFormat( &p_filter->fmt_in.video );
if( !p_filter->p_sys->p_tmp )
{
free( p_filter->p_sys );
return VLC_ENOMEM;
}
p_filter->p_sys->b_first = true;
p_filter->pf_video_filter = Filter;
config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
atomic_init( &p_filter->p_sys->i_factor,
var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "factor" ) );
var_AddCallback( p_filter, FILTER_PREFIX "factor",
MotionBlurCallback, p_filter->p_sys );
return VLC_SUCCESS;
}
开发者ID:0xheart0,项目名称:vlc,代码行数:38,代码来源:motionblur.c
示例8: filter_NewPicture
static picture_t *Deinterlace(filter_t *filter, picture_t *src)
{
filter_sys_t *sys = filter->p_sys;
mtime_t last_pts = sys->last_pts;
sys->last_pts = src->date;
vlc_vdp_video_field_t *f1 = src->context;
if (unlikely(f1 == NULL))
return src;
if (f1->structure != VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME)
return src; /* cannot deinterlace twice */
#ifdef VOUT_CORE_GETS_A_CLUE
picture_t *dst = filter_NewPicture(filter);
#else
picture_t *dst = picture_NewFromFormat(&src->format);
#endif
if (dst == NULL)
return src; /* cannot deinterlace without copying fields */
vlc_vdp_video_field_t *f2 = vlc_vdp_video_copy(f1); // shallow copy
if (unlikely(f2 == NULL))
{
picture_Release(dst);
return src;
}
picture_CopyProperties(dst, src);
dst->context = f2;
if (last_pts != VLC_TS_INVALID)
dst->date = (3 * src->date - last_pts) / 2;
else
if (filter->fmt_in.video.i_frame_rate != 0)
dst->date = src->date + ((filter->fmt_in.video.i_frame_rate_base
* CLOCK_FREQ) / filter->fmt_in.video.i_frame_rate);
dst->b_top_field_first = !src->b_top_field_first;
dst->i_nb_fields = 1;
src->i_nb_fields = 1;
assert(src->p_next == NULL);
src->p_next = dst;
if (src->b_progressive || src->b_top_field_first)
{
f1->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
f2->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD;
}
else
{
f1->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD;
f2->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
}
src->b_progressive = true;
dst->b_progressive = true;
return src;
}
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:59,代码来源:deinterlace.c
示例9: picture_NewFromFormat
/* Internal video allocator functions */
static picture_t *VideoBufferNew( filter_t *p_filter )
{
const video_format_t *p_fmt = &p_filter->fmt_out.video;
picture_t *p_picture = picture_NewFromFormat( p_fmt );
if( !p_picture )
msg_Err( p_filter, "Failed to allocate picture" );
return p_picture;
}
开发者ID:LDiracDelta,项目名称:vlc_censor_plugin,代码行数:10,代码来源:filter_chain.c
示例10: vout_display_PlacePicture
/**
* Return a direct buffer
*/
static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
{
vout_display_sys_t *p_sys = vd->sys;
(void)requested_count;
if (!p_sys->pool)
{
vout_display_place_t place;
vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
/* */
const uint32_t values[] = { place.x, place.y, place.width, place.height };
xcb_configure_window (p_sys->conn, p_sys->window,
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
values);
picture_t *pic = picture_NewFromFormat (&vd->fmt);
if (!pic)
return NULL;
assert (pic->i_planes == 1);
memset (p_sys->resource, 0, sizeof(p_sys->resource));
unsigned count;
picture_t *pic_array[MAX_PICTURES];
for (count = 0; count < MAX_PICTURES; count++)
{
picture_resource_t *res = &p_sys->resource[count];
res->p->i_lines = pic->p->i_lines;
res->p->i_pitch = pic->p->i_pitch;
if (PictureResourceAlloc (vd, res, res->p->i_pitch * res->p->i_lines,
p_sys->conn, p_sys->shm))
break;
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
PictureResourceFree (res, p_sys->conn);
memset (res, 0, sizeof(*res));
break;
}
}
picture_Release (pic);
if (count == 0)
return NULL;
p_sys->pool = picture_pool_New (count, pic_array);
/* TODO release picture resources if NULL */
xcb_flush (p_sys->conn);
}
return p_sys->pool;
}
开发者ID:paa,项目名称:vlc,代码行数:59,代码来源:x11.c
示例11: msg_Warn
inline static picture_t *video_new_buffer_filter( filter_t *p_filter )
{
if( video_update_format( VLC_OBJECT( p_filter ),
(decoder_owner_sys_t *)p_filter->owner.sys,
&p_filter->fmt_out ) ) {
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
return picture_NewFromFormat( &p_filter->fmt_out.video );
}
开发者ID:dougmencken,项目名称:vlc,代码行数:10,代码来源:mosaic_bridge.c
示例12: memset
picture_t *picture_New( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den )
{
video_format_t fmt;
memset( &fmt, 0, sizeof(fmt) );
video_format_Setup( &fmt, i_chroma, i_width, i_height,
i_width, i_height, i_sar_num, i_sar_den );
return picture_NewFromFormat( &fmt );
}
开发者ID:Annovae,项目名称:vlc,代码行数:10,代码来源:picture.c
示例13: outputThread
/**
* @brief Thread reading frames from the subprocess
*/
static void* outputThread(void* userData)
{
filter_t* intf = (filter_t*)userData;
filter_sys_t* sys = intf->p_sys;
msg_Info(intf, "outputThread: enter");
bool gotHeader = false;
while (true)
{
if (!gotHeader)
{
video_format_Init(&sys->outFormat, VLC_CODEC_I420);
if (1 != readY4mHeader(intf, &sys->outFormat, sys->stdout))
break;
gotHeader = true;
}
picture_t* outPic = picture_NewFromFormat(&sys->outFormat);
if(1 != readY4mFrame(intf, outPic, sys->stdout))
{
picture_Release(outPic);
break;
}
//msg_Info(intf, "outputThread: read picture");
// fixme: deinterlace filter does this, not sure if we need to;
// y4m header contains this information
outPic->b_progressive = true;
outPic->i_nb_fields = 2;
picture_fifo_Push(sys->outputFifo, outPic);
vlc_cond_signal(&sys->outputCond);
}
msg_Info(intf, "outputThread: exit");
sys->threadExit = true;
vlc_cond_signal(&sys->outputCond);
return userData;
}
开发者ID:walisser,项目名称:vlc-filter-pipe,代码行数:48,代码来源:y4mpipe.c
示例14: CommonUpdatePicture
/**
* It updates a picture data/pitches.
*/
int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
uint8_t *data, unsigned pitch)
{
if (fallback) {
if (*fallback == NULL) {
*fallback = picture_NewFromFormat(&picture->format);
if (*fallback == NULL)
return VLC_EGENERIC;
}
for (int n = 0; n < picture->i_planes; n++) {
const plane_t *src = &(*fallback)->p[n];
plane_t *dst = &picture->p[n];
dst->p_pixels = src->p_pixels;
dst->i_pitch = src->i_pitch;
dst->i_lines = src->i_lines;
}
return VLC_SUCCESS;
}
/* fill in buffer info in first plane */
picture->p->p_pixels = data;
picture->p->i_pitch = pitch;
picture->p->i_lines = picture->format.i_height;
/* Fill chroma planes for planar YUV */
if (picture->format.i_chroma == VLC_CODEC_I420 ||
picture->format.i_chroma == VLC_CODEC_J420 ||
picture->format.i_chroma == VLC_CODEC_YV12) {
for (int n = 1; n < picture->i_planes; n++) {
const plane_t *o = &picture->p[n-1];
plane_t *p = &picture->p[n];
p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
p->i_pitch = pitch / 2;
p->i_lines = picture->format.i_height / 2;
}
/* The dx/d3d buffer is always allocated as YV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
uint8_t *p_tmp = picture->p[1].p_pixels;
picture->p[1].p_pixels = picture->p[2].p_pixels;
picture->p[2].p_pixels = p_tmp;
}
}
return VLC_SUCCESS;
}
开发者ID:orewatakesi,项目名称:VLC-for-VS2010,代码行数:48,代码来源:common.c
示例15: calloc
subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
{
subpicture_region_t *p_region = calloc( 1, sizeof(*p_region ) );
if( !p_region )
return NULL;
if ( p_fmt->i_chroma == VLC_CODEC_YUVP )
{
video_format_Copy( &p_region->fmt, p_fmt );
/* YUVP should have a palette */
if( p_region->fmt.p_palette == NULL )
{
p_region->fmt.p_palette = calloc( 1, sizeof(*p_region->fmt.p_palette) );
if( p_region->fmt.p_palette == NULL )
{
free( p_region );
return NULL;
}
}
}
else
{
p_region->fmt = *p_fmt;
p_region->fmt.p_palette = NULL;
}
p_region->i_alpha = 0xff;
if( p_fmt->i_chroma == VLC_CODEC_TEXT )
return p_region;
p_region->p_picture = picture_NewFromFormat( p_fmt );
if( !p_region->p_picture )
{
video_format_Clean( &p_region->fmt );
free( p_region );
return NULL;
}
return p_region;
}
开发者ID:0xheart0,项目名称:vlc,代码行数:41,代码来源:subpicture.c
示例16: while
static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
{
sout_stream_sys_t *p_ssys = p_dec->p_owner->p_sys;
if( p_ssys->i_threads >= 1 )
{
int i_first_pic = p_ssys->i_first_pic;
if( p_ssys->i_first_pic != p_ssys->i_last_pic )
{
/* Encoder still has stuff to encode, wait to clear-up the list */
while( p_ssys->i_first_pic == i_first_pic )
{
#warning THERE IS DEFINITELY A BUG! LOCKING IS INSUFFICIENT!
msleep( 10000 );
barrier ();
}
}
}
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
return picture_NewFromFormat( &p_dec->fmt_out.video );
}
开发者ID:iamnpc,项目名称:myfaplayer,代码行数:22,代码来源:video.c
示例17: vout_snapshot_Set
void vout_snapshot_Set(vout_snapshot_t *snap,
const video_format_t *fmt,
const picture_t *picture)
{
if (!fmt)
fmt = &picture->format;
vlc_mutex_lock(&snap->lock);
while (snap->request_count > 0) {
picture_t *dup = picture_NewFromFormat(fmt);
if (!dup)
break;
picture_Copy(dup, picture);
dup->p_next = snap->picture;
snap->picture = dup;
snap->request_count--;
}
vlc_cond_broadcast(&snap->wait);
vlc_mutex_unlock(&snap->lock);
}
开发者ID:42TheAnswerToLife,项目名称:vlc,代码行数:22,代码来源:snapshot.c
示例18: picture_NewFromFormat
picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt,
unsigned count)
{
picture_t *picture[count ? count : 1];
unsigned i;
for (i = 0; i < count; i++) {
picture[i] = picture_NewFromFormat(fmt);
if (picture[i] == NULL)
goto error;
}
picture_pool_t *pool = picture_pool_New(count, picture);
if (!pool)
goto error;
return pool;
error:
while (i > 0)
picture_Release(picture[--i]);
return NULL;
}
开发者ID:n2i911,项目名称:vlc-with-fec,代码行数:23,代码来源:picture_pool.c
示例19: picture_NewFromFormat
picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt, int picture_count)
{
picture_t *picture[picture_count];
for (int i = 0; i < picture_count; i++) {
picture[i] = picture_NewFromFormat(fmt);
if (!picture[i])
goto error;
}
picture_pool_t *pool = picture_pool_New(picture_count, picture);
if (!pool)
goto error;
return pool;
error:
for (int i = 0; i < picture_count; i++) {
if (!picture[i])
break;
picture_Release(picture[i]);
}
return NULL;
}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:23,代码来源:picture_pool.c
示例20: SnapshotRatio
static void SnapshotRatio( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
if( !p_pic ) return;
if( p_sys->i_frames % p_sys->i_ratio != 0 )
{
p_sys->i_frames++;
return;
}
p_sys->i_frames++;
if( p_sys->scene.p_pic )
picture_Release( p_sys->scene.p_pic );
if( (p_sys->i_width <= 0) && (p_sys->i_height > 0) )
{
p_sys->i_width = (p_pic->format.i_width * p_sys->i_height) / p_pic->format.i_height;
}
else if( (p_sys->i_height <= 0) && (p_sys->i_width > 0) )
{
p_sys->i_height = (p_pic->format.i_height * p_sys->i_width) / p_pic->format.i_width;
}
else if( (p_sys->i_width <= 0) && (p_sys->i_height <= 0) )
{
p_sys->i_width = p_pic->format.i_width;
p_sys->i_height = p_pic->format.i_height;
}
p_sys->scene.p_pic = picture_NewFromFormat( &p_pic->format );
if( p_sys->scene.p_pic )
{
picture_Copy( p_sys->scene.p_pic, p_pic );
SavePicture( p_filter, p_sys->scene.p_pic );
}
}
开发者ID:Aki-Liang,项目名称:vlc-2.1.0.oldlib-2010,代码行数:37,代码来源:scene.c
注:本文中的picture_NewFromFormat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论