Bug #924 ยป 0002-updated-to-recent-libav-API.patch
dlna/avdetector.cpp | ||
---|---|---|
av_register_all();
|
||
if(!(ret = av_open_input_file(&FormatCtx, RecFile->Name(), NULL, 0, NULL))){
|
||
if(!(ret = avformat_open_input(&FormatCtx, RecFile->Name(), NULL, NULL))){
|
||
if((ret = av_find_stream_info(FormatCtx))<0){
|
||
ERROR("AVDetector: Cannot find the stream information");
|
||
}
|
||
... | ... | |
AVFormatContext *FormatCtx = NULL;
|
||
|
||
if(av_open_input_file(&FormatCtx, this->mResource.Filename, NULL, 0, NULL)){
|
||
if(avformat_open_input(&FormatCtx, this->mResource.Filename, NULL, NULL)){
|
||
ERROR("AVDetector: Error while opening file %s", this->mResource.Filename);
|
||
return -1;
|
||
}
|
||
... | ... | |
int cAudioVideoDetector::analyseVideo(AVFormatContext* FormatCtx)
|
||
{
|
||
AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_VIDEO);
|
||
AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, AVMEDIA_TYPE_VIDEO);
|
||
|
||
if(!VideoCodec){
|
||
ERROR("AVDetector: codec not found");
|
||
... | ... | |
}
|
||
int cAudioVideoDetector::analyseAudio(AVFormatContext* FormatCtx){
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, AVMEDIA_TYPE_AUDIO);
|
||
if(!AudioCodec){
|
||
ERROR("AVDetector: codec not found");
|
||
... | ... | |
return -1;
|
||
}
|
||
AVCodecContext* cCodecToolKit::getFirstCodecContext(AVFormatContext* FormatCtx, CodecType Type){
|
||
AVCodecContext* cCodecToolKit::getFirstCodecContext(AVFormatContext* FormatCtx, enum AVMediaType Type){
|
||
return cCodecToolKit::getFirstStream(FormatCtx, Type)->codec;
|
||
}
|
||
AVStream* cCodecToolKit::getFirstStream(AVFormatContext* FormatCtx, CodecType Type){
|
||
AVStream* cCodecToolKit::getFirstStream(AVFormatContext* FormatCtx, enum AVMediaType Type){
|
||
int Stream = -1; unsigned int i;
|
||
for(i = 0; i < FormatCtx->nb_streams; i++){
|
||
if(FormatCtx->streams[i]->codec->codec_type == Type){
|
dlna/profiles/ac3.cpp | ||
---|---|---|
AcceptedSamplingRates DLNA_SAMPLINGRATES_XAC3 = {{ KHz(48) }};
|
||
AudioPortionProfile cAC3Profiler::probeAudioProfile(AVFormatContext* FormatCtx){
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, AVMEDIA_TYPE_AUDIO);
|
||
if(AudioCodec->codec_id == CODEC_ID_AC3){
|
||
// VBR
|
dlna/profiles/container.cpp | ||
---|---|---|
VideoContainerProfile VCP = DLNA_VCP_UNKNOWN;
|
||
/* read the first 1024 bytes to get packet size */
|
||
pos = url_ftell(Ctx->pb);
|
||
len = get_buffer(Ctx->pb, buf, sizeof(buf));
|
||
pos = avio_tell(Ctx->pb);
|
||
len = avio_read(Ctx->pb, buf, sizeof(buf));
|
||
if (len != sizeof(buf)) PaketSize = 0;
|
||
for(int i = 0; i<DLNA_MPEG_TS_SIZE; i++){
|
dlna/profiles/mpa.cpp | ||
---|---|---|
AcceptedAudioChannels DLNA_AUDIOCHANNELS_MPEG1_L3X = { 2, { CHANNEL_LAYOUT_10, CHANNEL_LAYOUT_20 }, false };
|
||
AudioPortionProfile cMPEGAudioProfiler::probeAudioProfile(AVFormatContext* FormatCtx){
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_AUDIO);
|
||
AVCodecContext* AudioCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, AVMEDIA_TYPE_AUDIO);
|
||
if(AudioCodec->codec_id == CODEC_ID_MP1){
|
||
if(cCodecToolKit::matchesAcceptedBitrates(DLNA_BITRATES_MPEG1_L1_DVB, AudioCodec) &&
|
dlna/profiles/mpeg2.cpp | ||
---|---|---|
}
|
||
VideoPortionProfile cMPEG2Profiler::probeVideoProfile(AVFormatContext* FormatCtx){
|
||
AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, CODEC_TYPE_VIDEO);
|
||
AVStream* VideoStream = cCodecToolKit::getFirstStream(FormatCtx, CODEC_TYPE_VIDEO);
|
||
AVCodecContext* VideoCodec = cCodecToolKit::getFirstCodecContext(FormatCtx, AVMEDIA_TYPE_VIDEO);
|
||
AVStream* VideoStream = cCodecToolKit::getFirstStream(FormatCtx, AVMEDIA_TYPE_VIDEO);
|
||
MESSAGE(VERBOSE_METADATA, "Codec-ID: %d", VideoCodec->codec_id);
|
||
MESSAGE(VERBOSE_METADATA, "Codec-Name: %s", VideoCodec->codec_name);
|
inc/avdetector.h | ||
---|---|---|
class cCodecToolKit {
|
||
public:
|
||
static AVCodecContext* getFirstCodecContext(AVFormatContext* FormatCtx, CodecType Type);
|
||
static AVStream* getFirstStream(AVFormatContext* FormatCtx, CodecType Type);
|
||
static AVCodecContext* getFirstCodecContext(AVFormatContext* FormatCtx, enum AVMediaType Type);
|
||
static AVStream* getFirstStream(AVFormatContext* FormatCtx, enum AVMediaType Type);
|
||
static bool matchesAcceptedBitrates(AcceptedBitrates Bitrates, AVCodecContext* Codec);
|
||
static bool matchesAcceptedSystemBitrate(AcceptedBitrates Bitrate, AVFormatContext* Format);
|
||
static bool matchesAcceptedAudioChannels(AcceptedAudioChannels Channels, AVCodecContext* Codec);
|