|
|
@ -23,6 +23,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#include "libavutil/intreadwrite.h" |
|
|
|
#include "libavutil/intreadwrite.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "avformat.h" |
|
|
|
#include "avformat.h" |
|
|
|
#include "internal.h" |
|
|
|
#include "internal.h" |
|
|
|
|
|
|
|
|
|
|
@ -34,7 +35,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
#define LMLM4_MAX_PACKET_SIZE 1024 * 1024 |
|
|
|
#define LMLM4_MAX_PACKET_SIZE 1024 * 1024 |
|
|
|
|
|
|
|
|
|
|
|
static int lmlm4_probe(AVProbeData * pd) { |
|
|
|
static int lmlm4_probe(AVProbeData *pd) |
|
|
|
|
|
|
|
{ |
|
|
|
const unsigned char *buf = pd->buf; |
|
|
|
const unsigned char *buf = pd->buf; |
|
|
|
unsigned int frame_type, packet_size; |
|
|
|
unsigned int frame_type, packet_size; |
|
|
|
|
|
|
|
|
|
|
@ -43,7 +45,6 @@ static int lmlm4_probe(AVProbeData * pd) { |
|
|
|
|
|
|
|
|
|
|
|
if (!AV_RB16(buf) && frame_type <= LMLM4_MPEG1L2 && packet_size && |
|
|
|
if (!AV_RB16(buf) && frame_type <= LMLM4_MPEG1L2 && packet_size && |
|
|
|
frame_type != LMLM4_INVALID && packet_size <= LMLM4_MAX_PACKET_SIZE) { |
|
|
|
frame_type != LMLM4_INVALID && packet_size <= LMLM4_MAX_PACKET_SIZE) { |
|
|
|
|
|
|
|
|
|
|
|
if (frame_type == LMLM4_MPEG1L2) { |
|
|
|
if (frame_type == LMLM4_MPEG1L2) { |
|
|
|
if ((AV_RB16(buf + 8) & 0xfffe) != 0xfffc) |
|
|
|
if ((AV_RB16(buf + 8) & 0xfffe) != 0xfffc) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -58,7 +59,8 @@ static int lmlm4_probe(AVProbeData * pd) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int lmlm4_read_header(AVFormatContext *s) { |
|
|
|
static int lmlm4_read_header(AVFormatContext *s) |
|
|
|
|
|
|
|
{ |
|
|
|
AVStream *st; |
|
|
|
AVStream *st; |
|
|
|
|
|
|
|
|
|
|
|
if (!(st = avformat_new_stream(s, NULL))) |
|
|
|
if (!(st = avformat_new_stream(s, NULL))) |
|
|
@ -78,7 +80,8 @@ static int lmlm4_read_header(AVFormatContext *s) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { |
|
|
|
static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) |
|
|
|
|
|
|
|
{ |
|
|
|
AVIOContext *pb = s->pb; |
|
|
|
AVIOContext *pb = s->pb; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
unsigned int frame_type, packet_size, padding, frame_size; |
|
|
|
unsigned int frame_type, packet_size, padding, frame_size; |
|
|
|