-
Notifications
You must be signed in to change notification settings - Fork 13
/
FFMPEGTrack.cpp
66 lines (58 loc) · 1.22 KB
/
FFMPEGTrack.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <media/stagefright/MediaSource.h>
#include "FFMPEGTrack.h"
#define LOG_TAG "FFMPEGTrack"
namespace android{
FFMPEGTrack::FFMPEGTrack(const sp<FFMPEGExtractor> &extractor,int trackIndex,int streamIndex)
: mExtractor(extractor),
mTrackIndex(trackIndex),
mStreamIndex(streamIndex)
{
}
status_t FFMPEGTrack::start(MetaData *params)
{
return 0;
}
status_t FFMPEGTrack::stop()
{
return 0;
}
sp<MetaData> FFMPEGTrack::getFormat()
{
return mExtractor->getTrackMetaData(mTrackIndex,0);
}
int FFMPEGTrack::streamIndex()
{
return mStreamIndex;
}
int FFMPEGTrack::queueBuffer(MediaBuffer* buffer)
{
ENTER_FUNC();
mBuffers.push(buffer);
return 0;
}
int FFMPEGTrack::dequeueBuffer(MediaBuffer **buffer)
{
ENTER_FUNC();
if(mBuffers.isEmpty())
return -1;
MediaBuffer* mb = mBuffers[0];
*buffer = mb;
mBuffers.removeAt(0);
return OK;
}
status_t FFMPEGTrack::read(
MediaBuffer **buffer, const ReadOptions *options)
{
ENTER_FUNC();
while(dequeueBuffer(buffer) < 0){
int ret = mExtractor->feedMore(options);
if(ret != OK) {
return ret;
}
}
return OK;
}
FFMPEGTrack::~FFMPEGTrack()
{
}
}