1 /*
2  ** Copyright 2003-2010, VisualOn, Inc.
3  **
4  ** Licensed under the Apache License, Version 2.0 (the "License");
5  ** you may not use this file except in compliance with the License.
6  ** You may obtain a copy of the License at
7  **
8  **     http://www.apache.org/licenses/LICENSE-2.0
9  **
10  ** Unless required by applicable law or agreed to in writing, software
11  ** distributed under the License is distributed on an "AS IS" BASIS,
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ** See the License for the specific language governing permissions and
14  ** limitations under the License.
15  */
16 
17 /***********************************************************************
18 *       File: stream.c                                                 *
19 *                                                                      *
20 *       Description: VOME API Buffer Operator Implement Code           *
21 *                                                                      *
22 ************************************************************************/
23 
24 #include "stream.h"
25 
voAWB_InitFrameBuffer(FrameStream * stream)26 void voAWB_InitFrameBuffer(FrameStream *stream)
27 {
28     stream->set_ptr = NULL;
29     stream->frame_ptr_bk = stream->frame_ptr;
30     stream->set_len = 0;
31     stream->framebuffer_len = 0;
32     stream->frame_storelen = 0;
33 }
34 
voAWB_UpdateFrameBuffer(FrameStream * stream,VO_MEM_OPERATOR * pMemOP)35 void voAWB_UpdateFrameBuffer(
36         FrameStream *stream,
37         VO_MEM_OPERATOR *pMemOP
38         )
39 {
40     int  len;
41     len  = MIN(Frame_Maxsize - stream->frame_storelen, stream->set_len);
42     pMemOP->Copy(VO_INDEX_ENC_AMRWB, stream->frame_ptr_bk + stream->frame_storelen , stream->set_ptr, len);
43     stream->set_len -= len;
44     stream->set_ptr += len;
45     stream->framebuffer_len = stream->frame_storelen + len;
46     stream->frame_ptr = stream->frame_ptr_bk;
47     stream->used_len += len;
48 }
49 
voAWB_FlushFrameBuffer(FrameStream * stream)50 void voAWB_FlushFrameBuffer(FrameStream *stream)
51 {
52     stream->set_ptr = NULL;
53     stream->frame_ptr_bk = stream->frame_ptr;
54     stream->set_len = 0;
55     stream->framebuffer_len = 0;
56     stream->frame_storelen = 0;
57 }
58 
59