[haiku-bugs] Re: [Haiku] #7935: Text files on NTFS disk are mistakenly marked as MPEG-2 file

  • From: "phoudoin" <trac@xxxxxxxxxxxx>
  • Date: Mon, 22 Aug 2011 10:04:40 -0000

#7935: Text files on NTFS disk are mistakenly marked as MPEG-2 file
-----------------------------+---------------------------------------------
   Reporter:  Giova84        |      Owner:  3dEyes
       Type:  bug            |     Status:  new
   Priority:  normal         |  Milestone:  R1
  Component:  File           |    Version:  R1/alpha3
  Systems/NTFS               |   Keywords:  text file as video file on ntfs
 Resolution:                 |   Blocking:
 Blocked By:                 |   Platform:  x86
Has a Patch:  0              |
-----------------------------+---------------------------------------------

Comment (by phoudoin):

 The culprit is obviously src/data/beos_mime/video/mp2t :

 The sniffing rule only check that the first byte is 0x47 ('G'), but in
 fact a MPEG2 TS has most probably more than just one packet, so we could
 check that there a second TS packet at expected place instead:

 {{{
 resource(2, "META:SNIFF_RULE") "0.30 ([0] 0x47 [188] 0x47)";
 }}}

 Could you try, using File Types preferences, to modify your video/mp2t
 MIME sniffing rule to that new pattern?

 This will only handle TS with packet of 188 bytes, but that's the
 majority.
 Detecting both 188 and 204 packet sizes should be possible, but I'm not
 enough skilled in the sniffing rule syntax to have a solution to write a
 match for (first byte should be 0x47) AND (byte 188 OR byte 204 should be
 0x47). If someone knows, feel free.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7935#comment:2>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: