-
Notifications
You must be signed in to change notification settings - Fork 0
/
obs-vce-amf-surface.cpp
45 lines (35 loc) · 1.81 KB
/
obs-vce-amf-surface.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/******************************************************************************
Copyright (C) 2015 by Sean Nelson <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "obs-vce.h"
void init_pic_data(struct obs_amd *obs_vce, struct encoder_frame *frame)
{
debug("init_pic_data");
amf::AMFPlanePtr amf_plane[MAX_AV_PLANES];
//amf_plane[0] = obs_vce->vce_input->GetPlaneAt(0);
amf_plane[0] = obs_vce->vce_input->GetPlane(amf::AMF_PLANE_Y);
amf_plane[1] = obs_vce->vce_input->GetPlane(amf::AMF_PLANE_UV);
debug("SetPts");
obs_vce->vce_input->SetPts(frame->pts);
//obs_vce->vce_input->SetFrameType(amf::AMF_FRAME_PROGRESSIVE);
//obs_vce->vce_input->SetDuration();
if (obs_vce->vce_input->GetFormat() == amf::AMF_SURFACE_NV12) {
debug("video format NV12");
debug("NV12 Plane Count: %d", obs_vce->vce_input->GetPlanesCount());
size_t h_size = obs_vce->vid_out_info->height;
debug("copy frame plane Y to VCE");
memcpy(amf_plane[0]->GetNative(), frame->data[0], frame->linesize[0]*h_size);
debug("copy frame plane UV to VCE");
memcpy(amf_plane[1]->GetNative() , frame->data[1], frame->linesize[1]*h_size/2);
}
}