Skip to content

Commit

Permalink
refactor(demuxer_service): support dataSoure with range
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Feb 28, 2020
1 parent 428f79b commit e7fce23
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion framework/base/media/framework_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef int64_t (*demuxer_callback_seek)(void *arg, int64_t offset, int whence);

typedef void (*demuxer_callback_interrupt_data)(void *arg, int inter);

typedef int (*demuxer_callback_open)(void *arg, const char *url);
typedef int (*demuxer_callback_open)(void *arg, const char *url, int64_t start, int64_t end);

enum {
EN_FRAMEWORK_SERVICE_PLAYER_BASE = 0x00001000,
Expand Down
4 changes: 3 additions & 1 deletion framework/demuxer/demuxer_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Created by moqi on 2018/2/1.
//
#define LOG_TAG "demuxer_service"

#include <utils/frame_work_log.h>
#include <cassert>
#include <utils/errors/framework_error.h>
Expand Down Expand Up @@ -368,7 +369,7 @@ namespace Cicada {
return pHandle->mPDataSource->Seek(offset, whence);
}

int demuxer_service::open_callback(void *arg, const char *url)
int demuxer_service::open_callback(void *arg, const char *url, int64_t start, int64_t end)
{
auto *pHandle = static_cast<demuxer_service *>(arg);

Expand All @@ -377,6 +378,7 @@ namespace Cicada {
pHandle->mPProbBuffer = nullptr;
}

pHandle->mPDataSource->setRange(start, end);
return pHandle->mPDataSource->Open(url);
}

Expand Down
2 changes: 1 addition & 1 deletion framework/demuxer/demuxer_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace Cicada {

static int64_t seek_callback(void *arg, int64_t offset, int whence);

static int open_callback(void *arg, const char *url);
static int open_callback(void *arg, const char *url, int64_t start, int64_t end);

static void interrupt_callback(void *arg, int inter);

Expand Down

0 comments on commit e7fce23

Please sign in to comment.